cca8828565
* Use a stack channel for deserialization * multi-threaded * add object dictionary pool * more pooling * adjust sqlite transport * format * Optimize IsPropNameValid * object loader first pass * save test * add cache pre check * save better deserialize * mostly works * uses tasks but slower at end * rework to make more sense * add check to avoid multi-deserialize * modify max parallelism * async enqueuing of tasks * switch to more asyncenumerable * fmt * fmt * cleanup sqlite * make ServerObjectManager * revert change * add ability to skip cache check * cache json to know what is loaded * testing * clean up usage * clean up and added new op * Fix exception handling * fixing progress * remove codejam * remove stackchannel * remove console writeline * add cache check shortcut for root object * recevie2 benchmark --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
37 lines
899 B
C#
37 lines
899 B
C#
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Serialization.Testing;
|
|
|
|
public class Progress(bool write) : IProgress<ProgressArgs>
|
|
{
|
|
private readonly TimeSpan DEBOUNCE = TimeSpan.FromMilliseconds(500);
|
|
private DateTime _lastTime = DateTime.UtcNow;
|
|
|
|
private long _totalBytes;
|
|
|
|
public void Report(ProgressArgs value)
|
|
{
|
|
if (write)
|
|
{
|
|
if (value.ProgressEvent == ProgressEvent.DownloadBytes)
|
|
{
|
|
Interlocked.Add(ref _totalBytes, value.Count);
|
|
}
|
|
var now = DateTime.UtcNow;
|
|
if (now - _lastTime >= DEBOUNCE)
|
|
{
|
|
if (value.ProgressEvent == ProgressEvent.DownloadBytes)
|
|
{
|
|
Console.WriteLine(value.ProgressEvent + " t " + _totalBytes);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine(value.ProgressEvent + " c " + value.Count + " t " + value.Total);
|
|
}
|
|
|
|
_lastTime = now;
|
|
}
|
|
}
|
|
}
|
|
}
|