michel-kraemer / actson-rs Goto Github PK
View Code? Open in Web Editor NEW๐ฌ A reactive (or non-blocking, or asynchronous) JSON parser
License: MIT License
๐ฌ A reactive (or non-blocking, or asynchronous) JSON parser
License: MIT License
When I run cargo bench
in the root, I get the following error:
error[E0432]: unresolved import `actson::serde_json`
--> benches/bench.rs:6:39
|
6 | use actson::{feeder::SliceJsonFeeder, serde_json::from_slice, JsonEvent, JsonParser};
| ^^^^^^^^^^ could not find `serde_json` in `actson`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `actson` (bench "bench") due to 1 previous error
warning: build failed, waiting for other jobs to finish...
actson-rs version: main
branch, f33a94290b50ec8cacb73fdc1be7684af7b9fe38
commit, Rustc version: 1.76
Hi!
I evaluate Profile-Guided Optimization (PGO) performance improvements for applications and libraries (including other JSON parsers) in different software domains - all current results can be found here. According to the tests, PGO helps to improve performance in various software domains. I decided to perform PGO benchmarks on the actson-rs
library too since some library users may be interested in improving the library's performance. I did some benchmarks and here are the results.
actson-rs
version: main
branch on commit 332b8922eb6b3960956902fe80cc031c13f09dd6
For benchmark purposes, I use two benchmarks: via cargo bench
and geojson benchmarks.
For cargo bench
set of benchmarks, the PGO training phase is done with cargo pgo bench
, PGO optimization phase - with cargo pgo optimize bench
.
For geojson set of benchmarks, I used run-all.sh
script. For the PGO training phase, I used completely the same script but the instrumented binary is built with cargo pgo build
, and the number of runs was settled to 1 since there is no need to run more frequently for the training phase in this case.
All PGO-related routines are done with cargo-pgo.
All benchmarks are done on the same machine, with the same hardware/software during runs, with the same background "noise" (as much as I can guarantee, of course).
Firstly, here are the results for cargo bench
:
Geojson results:
Raw files (results.json
files) are also saved on my machine - I can share them as well if you are interested.
At least in the provided by project benchmarks, there are measurable improvements in many cases. Also, I got the same results for other JSON benchmarks that can be found in the awesome-pgo
repo.
Maybe mentioning these results somewhere in the README (or any other user-facing documentation) can be a good idea. Probably you will be interested in integrating building actson-rs
with PGO into your applications - who knows :)
Please do not treat the issue as a bug or something like that - it's just a benchmark report.
JsonParser
taking a reference to Feeder
makes it difficult to write abstractions that contain both the parser and the feeder, as this would cause the struct to be self referential. This brings difficulties in Rust.
Feeder
JsonParser
should either take ownership of Feeder
, either through exclusive ownership or through shared ownership (Arc
).
next_event(..)
JsonParser
should not own, or have a reference to, a Feeder
. Instead the dependency can be provided when JsonParser::next_event(...)
is called. This has the additional benefit of making the JsonParser
non-generic, merely the next_event(..)
method needs to be generic over Feeder
.
Proposal 2 has been implemented and a pull request will be made.
BufReaderJsonFeeder
and AsyncBufReaderJsonFeeder
have a similar issue, in that they contain an exclusive reference to a BufReader
, instead of taking ownership.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.