Comments (6)
I have been reworking integer type (by using primitives (i128) by default, and switching to larger ones on overflows, or if big one is created manually) Hopefully I can open draft PR in the end of week. The resulting integer will be enum, and the type of the big integers does not matter that much anymore.
Not sure if it is the best approach, but it is the one I chose after trying quite many different things. Let's leave those comments for the PR. It can be completely changed still.
Seems like integers are not the only problem with UPER. The extensive use of new vector buffers and moving this data contributes more. Default low capacity's in vectors, a lot single pushes and overall creation of new buffers instead of sharing pointer of one or reusing existing allocations slows down quite much.
Some initial differences on M2 Pro from the integer change:
UPER:
COER (The difference was much more impactful)
I have also made initial rework for optimising allocations in COER (the results below are based on the int remake) Maybe UPER will follow if I have time.
So by changing the integer type and reducing allocations, it was already possible to get 3x speedup at least for COER, based on the benchmark base of @dudycz .
Allocations could be improved further but I am having painful issues with lifetimes.
from rasn.
Thank you for your issue! Would you be able to attach the flamegraphs? That would be very helpful. In general the initial version I made prioritised correctness over performance so there's likely a lot of places where it could be more efficient. I already know that I haven't added the empty struct optimisation that was added to BER to PER.
from rasn.
I had to encode sample.asn 256 times to get something recorded in flamegraph. Here it is:
from rasn.
Seems like your test bench uses mostly integers. asn1-codecs
crate seems to use i128
internally for Integer type while rasn
uses BigInts. I would guess that this plays big factor at least.
I think there was a plan to make inner implementation of integer types as feature, so that it would be possible to select different internal type for performance reasons if very big numbers are not required.
from rasn.
Yeah, that's still a todo, I should write up an issue giving details in case someone else who has more time is interested.
from rasn.
Yeah, that's still a todo, I should write up an issue giving details in case someone else who has more time is interested.
I think this is rather important optimisation in general and should not take too much work to implement, if we have, for example, just the i128 and BigInts as initial options. If you have time to write what you had on your mind, maybe I can try to do it.
from rasn.
Related Issues (20)
- Traits for macro expansion not always correctly carried with generics when using Encode/Decode HOT 2
- Prettyprint for Errors HOT 3
- Unable to round-trip with APER HOT 9
- Unable to round-trip NumericString with APER HOT 1
- Proc macro should error on unknown attributes
- Getting default value of type not currently possible when implementing codec HOT 5
- Question about DER encoding discrepancy between versions (0.7 -> 0.8) HOT 1
- Incorrect DER Encoding Order of SET OF Type HOT 1
- stack overflow when comparing &ObjectIdentifier with &[u32] HOT 1
- DER decoding of empty sequences is incredibly slow HOT 4
- UnbindRequest encodes/decodes incorrectly
- Comparing Object Identifier causes SIGSEGV HOT 2
- `index_map` and `character_map` are broken (one static map is initialized for all types, and thus doesn't work for different types)
- Breaking change in 0.12.6 breaks compilation of apple-codesign HOT 1
- Tokei lines of code badge doesn't work
- Mutable Access to Encoded Values HOT 2
- Is it possible to get &[u8] for the underlying decoded value
- Standards crates (`rasn-pkix`, `rasn-ocsp`, etc.) should not enable `rasn`'s default feature HOT 2
- Failed windows builds HOT 1
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 rasn.