-
Notifications
You must be signed in to change notification settings - Fork 16
measuring performance against tungstenite-rs #302
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
Comments
I think the websocket-lite benchmark should be ok. You should expect zero memory allocations from the profiler loop (that is, after the initial client connect). When developing websocket clients I used https://github.com/KDE/heaptrack to verify this manually. (The idea is that every Message struct has a reference-counted reference back to a single buffer owned by the codec.) I'll try to find time to run the benchmark through heaptrack and check for any rogue memory allocations. |
I guess the bigger point is: if the performance of tungstenite and websocket-lite aren't significantly different, than what's the point of this project? Perhaps something is off from the benchmark? |
This is an interesting result, thanks for putting together the benchmark. The initial focus of websocket-lite was to have zero memory allocations after initialisation. Allocations were inherent in the tungstenite design at the time (you have to call Even without the overhead of memory allocations, parsing of messages on websocket-lite seems a little slower. Hopefully I can see if the two libraries are doing anything different. |
I think the timings are close because they're dominated by the network itself, even on localhost; that is, the In terms of elapsed time, the two libraries are close for me, with websocket-lite marginally faster when you include the With In terms of context - the aim of websocket-lite is to give you a parsed message as quickly as possible, with predictable timings consistent from one message to the next. That is, if we can measure the interval between the last byte of the frame and the return of the |
i'm working on a project using
tungstenite
right now, and after profiling my code I noticed it's doing a lot of allocations so i'm looking to replace it with something faster and more lightweight. i put together a quick benchmark oftungstenite
andwebsocket-lite
clients reading a bunch of json from a simple server and compared the results, the difference was not as large as I had hoped. do you have any of your own benchmarks i can compare against? or maybe my benchmark was not representative ofwebsocket-lite
's actual performance?criterion code, which i ran with
cargo bench
:The text was updated successfully, but these errors were encountered: