Coder Social home page Coder Social logo

michel-kraemer / actson-rs Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 2.0 1.58 MB

๐ŸŽฌ A reactive (or non-blocking, or asynchronous) JSON parser

License: MIT License

Rust 33.69% Jupyter Notebook 66.02% Shell 0.30%
asynchronous big-data json non-blocking non-blocking-io parser reactive streaming

actson-rs's People

Contributors

bernhardlthomas avatar dependabot[bot] avatar michel-kraemer avatar zozs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

actson-rs's Issues

Cargo bench fails to compile

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

Profile-Guided Optimization (PGO) benchmark results

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.

Test environment

  • Fedora 39
  • Linux kernel 6.7.6
  • AMD Ryzen 9 5900x
  • 48 Gib RAM
  • SSD Samsung 980 Pro 2 Tib
  • Compiler - Rustc 1.76
  • actson-rs version: main branch on commit 332b8922eb6b3960956902fe80cc031c13f09dd6
  • Disabled Turbo boost for improving consistency across runs

Benchmark

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).

Results

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.

Ownership of Feeder in the context of JsonParser

Issue

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.

Proposals

Proposal 1: Own Feeder

JsonParser should either take ownership of Feeder, either through exclusive ownership or through shared ownership (Arc).

Proposal 2: Provide feeder at call site of 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.

Pull Request

Proposal 2 has been implemented and a pull request will be made.

Related issues

BufReaderJsonFeeder and AsyncBufReaderJsonFeeder have a similar issue, in that they contain an exclusive reference to a BufReader, instead of taking ownership.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.