Comments (8)
Ok, I found the issue, we lacked handling for valuetypes when creating new objects so it fell back onto the FormattingServices.GetEmptyObject.
Still slower than NetSerializer here but I'd say that is expected as we carry more state around.
from wire.
Twice as slow might have been over exaggerated, 1.5 times slower is more correct.
400 ms vs 600 ms.
Changing it to a class brings it down to 550, but still significantly slower than NetSerializer.
also, it is only the serialize step that is slower, deserialize is actually faster.
from wire.
Nice finding. Will take a look at it.
Just to be specific:
- there are 4 virtual calls
- bit converter calll should look like
NoAllocBitConverter.GetBytes(x.field1,buffer)
from wire.
4?
The primitives are inlined into the ICompiler pipeline arnt they? EmitWrite.
That leaves just the outer function to write the entire struct, or am I missing something now?
from wire.
4 calls to Stream.Write
which is virtual
.
from wire.
Are there any specific tricks NetSerializer uses in terms of structs?
No, I don't think so (well, there's "direct serialization", but that's not relevant here).
You can actually make NetSerializer emit an assembly dll file containing all the generated code, by doing a debug build and uncommenting the "GenerateDebugAssembly" line in Test/Tester.cs. That assembly can't be used as such, but you can dissassemble it, which I've found a great way to understand issues.
from wire.
I've got it down to only differ with some 50ms.
I realized that we do not need to lookup known types while serializing to determine if we need to write manifest or not.
We can simply create an object serializer that never writes the manifest if the type is known when the serializer is generated and register that into our serializer lookup.
This made known type serialization a lot faster.
from wire.
Closing this one, the perf is good enough in the current code
from wire.
Related Issues (20)
- NVM
- Serialization of F# Map HOT 4
- No support for struct with a non-default constructor? HOT 8
- Is Serializer thread safe? HOT 2
- AmbiguousMatchException when serializing a type with multiple AddRange methods HOT 1
- Invalid code generation on fields of interface type HOT 5
- Wire performance improvements HOT 3
- CollectionTests.CanSerializeDictionaryKeysAndValuesByteChar is failing HOT 1
- Wire 0.8.2 is not compatible with 0.8.1 HOT 6
- Stack overflow when serializing/deserializing LinkedList
- OSS license for Wire HOT 2
- Support for IDictionary HOT 3
- Serialize - DeSerialize between similar types. HOT 4
- Speedup dials to compare performance with bond simple binary protocol.
- .NET Core serialization issues
- Signed Wire NuGet package
- support DataContract/DataMember/IgnoreDataMember
- Does wire do zig-zag / 7bit encoding?
- Wire.Extensions.TypeEx CoreAssemblyName ignore mscorelib/System.Private.CoreLib
- .NET Core 3 - Cannot Deserialize
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wire.