Replies: 2 comments 9 replies
-
Thank you for your question! Yes, this an optimisation I'd like to have implemented after PER support has been merged. My current thought was to keep the same As an aside, I'd love to see you benchmark the current version of rasn against NetSNMP, because in my own benchmarking, rasn is only a couple microseconds slower than |
Beta Was this translation helpful? Give feedback.
-
me again :) been a while and finally might have some things coming up again soon-ish related to SNMP so figured I'd bump this topic a bit since I believe PER support has been added, right? do you think the library is at an appropriate point to where I could look at attempting to implement this? 👀 (and thanks for all the work you and others have put in, this library is a great resource to have around!) |
Beta Was this translation helpful? Give feedback.
-
it's me again :D I didn't necessarily want to make this an issue yet to see what some possible ideas could be for improving my situation below
I've been toying around with a high level SNMP (specifically v2c) crate that has been an off/on side-project at work for quite a while to see if I can move some of our infrastructure over from Python, and while working on that I've been trying to get a sense of what areas I need to keep an eye on performance-wise to keep parity with the NetSNMP Python library that we use, and one of the things that I noticed when doing perf analysis is that a lot of time is spend decoding + allocating the big integer type, which is understandable as a default since theoretically integers can be of any size in ASN.1, however, in SNMP they're pretty much entirely fixed-width integer types, which means that always decoding into a big integer type that always allocates (which is the case with
BigInt
right now) incurs a lot of overhead. I did some preliminary work last week and added some stuff to the current benchmark:then implemented specific
decode_<ty>
methods to the various integer types toDecoder
and saw an approximate ~23% performance improvement before adding them vs after on the benchmark for the various encodings when forwarding the types to theirdecode_<ty>
function instead of always going throughBigInt
then converting. (I'm on a Framework with the11th Gen Intel i7-1165G7 (8) @ 4.700GHz
CPU with 32 GiB RAM, running Arch) I think that this confirms my suspicion that figuring out some way to not always heap allocate is going to be somewhat necessary to reach close to performance parity with NetSNMP because the tables that we need to walk are sometimes massive and all of the intermediate allocations really begin to add up even though network latency is the biggest issue by far.but is adding those
decode_<ty>
trait methods the right direction do you think? or is there potentially some other way which we can expose this behavior without creating a performance footgun accidentally?Beta Was this translation helpful? Give feedback.
All reactions