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

Serialization Allocation changes #124

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<!-- Keep at 7 for side by side -->
<PackageVersion Include="Microsoft.Data.Sqlite" Version="7.0.7" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.8" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0"/>
<PackageVersion Include="Microsoft.Extensions.Logging" Version="2.2.0"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageVersion Include="MongoDB.Driver" Version="2.19.2" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
Expand All @@ -30,4 +32,4 @@
<GlobalPackageReference Include="GitVersion.MsBuild" Version="5.12.0" />
<GlobalPackageReference Include="Speckle.InterfaceGenerator" Version="0.9.6" />
</ItemGroup>
</Project>
</Project>
7 changes: 7 additions & 0 deletions Speckle.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Tests.Performance", "tests\Speckle.Sdk.Tests.Performance\Speckle.Sdk.Tests.Performance.csproj", "{870E3396-E6F7-43AE-B120-E651FA4F46BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Performance.Testing", "tests\Speckle.Sdk.Performance.Testing\Speckle.Sdk.Performance.Testing.csproj", "{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -84,6 +86,10 @@ Global
{870E3396-E6F7-43AE-B120-E651FA4F46BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{870E3396-E6F7-43AE-B120-E651FA4F46BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{870E3396-E6F7-43AE-B120-E651FA4F46BD}.Release|Any CPU.Build.0 = Release|Any CPU
{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A413E196-3696-4F48-B635-04B5F76BF9C9} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
Expand All @@ -95,5 +101,6 @@ Global
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
{B623BD21-5CAA-43F9-A539-1835276C220E} = {DA2AED52-58F9-471E-8AD8-102FD36129E3}
{870E3396-E6F7-43AE-B120-E651FA4F46BD} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
{F3423F2A-3C83-4F4A-94CF-5D2214BF6CC9} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
EndGlobalSection
EndGlobal
43 changes: 37 additions & 6 deletions src/Speckle.Objects/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw=="
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.ComponentModel.Annotations": {
"type": "Transitive",
Expand All @@ -178,12 +178,12 @@
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==",
"resolved": "4.5.5",
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
"dependencies": {
"System.Buffers": "4.4.0",
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
},
"System.Numerics.Vectors": {
Expand Down Expand Up @@ -238,6 +238,8 @@
"Microsoft.Data.Sqlite": "[7.0.7, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[2.2.0, )",
"Microsoft.Extensions.Logging": "[2.2.0, )",
"Microsoft.Extensions.ObjectPool": "[8.0.8, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.1, )",
"Polly": "[7.2.3, )",
"Polly.Contrib.WaitAndRetry": "[1.1.1, )",
"Polly.Extensions.Http": "[3.0.0, )",
Expand Down Expand Up @@ -290,6 +292,21 @@
"Microsoft.Extensions.Options": "2.2.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "CentralTransitive",
"requested": "[8.0.8, )",
"resolved": "8.0.8",
"contentHash": "wnjTFjEvvSbOs3iMfl6CeJcUgPHZMYUB9uAQbGQGxGwVRl4GydNpMSkVntTzoi7AqQeYumU9yDSNeVbpq+ebow=="
},
"Microsoft.IO.RecyclableMemoryStream": {
"type": "CentralTransitive",
"requested": "[3.0.1, )",
"resolved": "3.0.1",
"contentHash": "s/s20YTVY9r9TPfTrN5g8zPF1YhwxyqO6PxUkrYTGI2B+OGPe9AdajWZrLhFqXIvqIW23fnUE4+ztrUWNU1+9g==",
"dependencies": {
"System.Memory": "4.5.5"
}
},
"Polly": {
"type": "CentralTransitive",
"requested": "[7.2.3, )",
Expand Down Expand Up @@ -498,6 +515,8 @@
"Microsoft.Data.Sqlite": "[7.0.7, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[2.2.0, )",
"Microsoft.Extensions.Logging": "[2.2.0, )",
"Microsoft.Extensions.ObjectPool": "[8.0.8, )",
"Microsoft.IO.RecyclableMemoryStream": "[3.0.1, )",
"Polly": "[7.2.3, )",
"Polly.Contrib.WaitAndRetry": "[1.1.1, )",
"Polly.Extensions.Http": "[3.0.0, )",
Expand Down Expand Up @@ -550,6 +569,18 @@
"Microsoft.Extensions.Options": "2.2.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "CentralTransitive",
"requested": "[8.0.8, )",
"resolved": "8.0.8",
"contentHash": "wnjTFjEvvSbOs3iMfl6CeJcUgPHZMYUB9uAQbGQGxGwVRl4GydNpMSkVntTzoi7AqQeYumU9yDSNeVbpq+ebow=="
},
"Microsoft.IO.RecyclableMemoryStream": {
"type": "CentralTransitive",
"requested": "[3.0.1, )",
"resolved": "3.0.1",
"contentHash": "s/s20YTVY9r9TPfTrN5g8zPF1YhwxyqO6PxUkrYTGI2B+OGPe9AdajWZrLhFqXIvqIW23fnUE4+ztrUWNU1+9g=="
},
"Polly": {
"type": "CentralTransitive",
"requested": "[7.2.3, )",
Expand Down
4 changes: 1 addition & 3 deletions src/Speckle.Sdk/Api/Operations/Operations.Receive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ public async Task<Base> Receive(
}

// Shoot out the total children count, wasteful
var count = (
await ClosureParser.GetClosuresAsync(objString, localTransport.CancellationToken).ConfigureAwait(false)
).Count;
var count = ClosureParser.GetClosures(objString).Count;

onTotalChildrenCountKnown?.Invoke(count);

Expand Down
2 changes: 1 addition & 1 deletion src/Speckle.Sdk/Api/Operations/Operations.Send.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal static async Task<string> SerializerSend(
)
{
string obj = serializer.Serialize(value);
Task[] transportAwaits = serializer.WriteTransports.Select(t => t.WriteComplete()).ToArray();
Task[] transportAwaits = serializer.WriteTransports.Select(t => t.WriteComplete().AsTask()).ToArray();

cancellationToken.ThrowIfCancellationRequested();

Expand Down
6 changes: 6 additions & 0 deletions src/Speckle.Sdk/Api/Operations/Operations.Serialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public string Serialize(Base value, CancellationToken cancellationToken = defaul
return serializer.Serialize(value);
}

public string Serialize2(Base value, CancellationToken cancellationToken = default)
{
var serializer = new SpeckleObjectSerializer2 { CancellationToken = cancellationToken };
return serializer.Serialize(value);
}

/// <remarks>
/// Note: if you want to pull an object from a Speckle Transport or Server,
/// please use
Expand Down
Loading
Loading