[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes to reduce allocations #848

Merged
merged 12 commits into from
Feb 20, 2019
27 changes: 2 additions & 25 deletions Emby.Server.Implementations/Data/BaseSqliteRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,31 +224,14 @@ protected void RunDefaultInitialization(ManagedConnection db)
});
}

db.ExecuteAll(string.Join(";", queries.ToArray()));
db.ExecuteAll(string.Join(";", queries));
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
}

protected virtual bool EnableTempStoreMemory => false;

protected virtual int? CacheSize => null;

internal static void CheckOk(int rc)
{
string msg = "";

if (raw.SQLITE_OK != rc)
{
throw CreateException((ErrorCode)rc, msg);
}
}

internal static Exception CreateException(ErrorCode rc, string msg)
{
var exp = new Exception(msg);

return exp;
}

private bool _disposed;
protected void CheckDisposed()
{
Expand Down Expand Up @@ -375,13 +358,6 @@ public void Dispose()
}
}

public class DummyToken : IDisposable
{
public void Dispose()
{
}
}

public static IDisposable Read(this ReaderWriterLockSlim obj)
{
//if (BaseSqliteRepository.ThreadSafeMode > 0)
Expand All @@ -390,6 +366,7 @@ public static IDisposable Read(this ReaderWriterLockSlim obj)
//}
return new WriteLockToken(obj);
}

public static IDisposable Write(this ReaderWriterLockSlim obj)
{
//if (BaseSqliteRepository.ThreadSafeMode > 0)
Expand Down
Loading