4cc78c4bc9
* 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 * Hides ObjectPool dependency * fmt * Use the 1.0 BCL async to try to be more compatible * rename to dependencies * Move Polly to internal dependencies * format * remove more old references * remove stackchannel * fixes for registration * remove console writeline * add cache check shortcut for root object * start refactoring send * recevie2 benchmark * add test for deserialize new * use channels for sending * test and fixes * Use same asyncinterfaces as Dynamo. Merge fixes * clean up * fix download object progress * put back from bad merge * intermediate commit: separating get child function from serializer * send didn't error * add channels * Use net48, netstandard2.1 and net8 * remove collection special case * have to make a tree of tasks even though it may serialize things twice * pre-id changing during serialize * need AsyncInterfaces for net48 :( * options changes * revert to netstandard2.0 and net8.0 * fix totals * revert httpcontext changes * format * clean up * active tasks works when accounting for id not being stable * add id tests * more fixes * works * format * Convert to BaseItem and use single SQLite checks to avoid locks * use locks and batch sqlite operations * hook up and handle null ids * remove unused parameter * remove progress from serializer itself * invert has objects call * readd object references * format * fix tests * remove active tasks check * bug fix for json cache * remove locks from sqlite * General Send test * add childclosures * redo extract all to be enumerable * group tests in projects * caching json does matter * cache checking should be managed by channels * format * Merge pull request #152 from specklesystems/new-json-test Uses a new objects test in Revit for serialization tests * add skip * add new roundtrip test * fix finish * clean up tests * check happens in serialize...don't do it twice * better progress reporting * fix progress reporting * only use detached properties when children gathering * move detached tests * add detached tests * fix merge * Fix progress change * fix more tests --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
using BenchmarkDotNet.Attributes;
|
|
using BenchmarkDotNet.Engines;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Speckle.Objects.Geometry;
|
|
using Speckle.Sdk.Api;
|
|
using Speckle.Sdk.Api.GraphQL.Enums;
|
|
using Speckle.Sdk.Api.GraphQL.Models;
|
|
using Speckle.Sdk.Common;
|
|
using Speckle.Sdk.Credentials;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
using Speckle.Sdk.Serialisation;
|
|
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Tests.Performance.Benchmarks;
|
|
|
|
/// <summary>
|
|
/// How many threads on our Deserializer is optimal
|
|
/// </summary>
|
|
[MemoryDiagnoser]
|
|
[SimpleJob(RunStrategy.Monitoring, iterationCount: 1)]
|
|
public class GeneralSendTest
|
|
{
|
|
private Base _testData;
|
|
private IOperations _operations;
|
|
private ServerTransport _remote;
|
|
private Account acc;
|
|
private Client client;
|
|
|
|
private Project _project;
|
|
|
|
[GlobalSetup]
|
|
public async Task Setup()
|
|
{
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
|
|
using var dataSource = new TestDataHelper();
|
|
await dataSource
|
|
.SeedTransport(
|
|
new Account() { serverInfo = new() { url = "https://latest.speckle.systems/" } },
|
|
"2099ac4b5f",
|
|
"30fb4cbe6eb2202b9e7b4a4fcc3dd2b6",
|
|
false
|
|
)
|
|
.ConfigureAwait(false);
|
|
|
|
SpeckleObjectDeserializer deserializer = new() { ReadTransport = dataSource.Transport };
|
|
string data = await dataSource.Transport.GetObject(dataSource.ObjectId).NotNull();
|
|
_testData = await deserializer.DeserializeAsync(data).NotNull();
|
|
_operations = TestDataHelper.ServiceProvider.GetRequiredService<IOperations>();
|
|
|
|
acc = TestDataHelper
|
|
.ServiceProvider.GetRequiredService<IAccountManager>()
|
|
.GetAccounts("https://latest.speckle.systems")
|
|
.First();
|
|
|
|
client = TestDataHelper.ServiceProvider.GetRequiredService<IClientFactory>().Create(acc);
|
|
|
|
_project = await client.Project.Create(
|
|
new($"General Send Test run {Guid.NewGuid()}", null, ProjectVisibility.Public)
|
|
);
|
|
_remote = TestDataHelper.ServiceProvider.GetRequiredService<IServerTransportFactory>().Create(acc, _project.id);
|
|
}
|
|
|
|
[Benchmark(Baseline = true)]
|
|
public async Task<string> Send_old()
|
|
{
|
|
using SQLiteTransport local = new();
|
|
var res = await _operations.Send(_testData, [_remote, local]);
|
|
return await TagVersion($"Send_old {Guid.NewGuid()}", res.rootObjId);
|
|
}
|
|
|
|
[Benchmark]
|
|
public async Task<string> Send_new()
|
|
{
|
|
var res = await _operations.Send2(new(acc.serverInfo.url), _project.id, acc.token, _testData);
|
|
return await TagVersion($"Send_new {Guid.NewGuid()}", res.rootObjId);
|
|
}
|
|
|
|
private async Task<string> TagVersion(string name, string objectId)
|
|
{
|
|
var model = await client.Model.Create(new(name, null, _project.id));
|
|
return await client.Version.Create(new(objectId, model.id, _project.id));
|
|
}
|
|
}
|