Rust and mmap

The library is published on crates.io as mmapjsonfile and can help with counting and filtering json files with records all of which as symmetric in their structure ( json array of objects ) as the format below.

[{..}, {..}, ..]

The idea of using memory mapped i/o is check the performance while filtering and creating another file etc from rust while putting serde in harmsway :grin:.

Here is the best read on the topic from Linux forums.

Functionality

Test

The airports JSON has been taken from the location. It needs to be downloaded and put in the data/ directory.

Thanks to the original mmap lib.

General performance seems to be of the order below.

( all tests below are run in a macbook )

cargo test --release -- --nocapture --test-threads 1

Debug
Release (1.1 GB - appended 16MB json multiple times - 3,355,711 records)

test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Doc-tests mmapjsonfile

running 5 tests test src/lib.rs - count (line 294) ... ok test src/lib.rs - countwithfilter (line 197) ... ok test src/lib.rs - distinctoffield (line 371) ... ok test src/lib.rs - filter (line 47) ... ok test src/lib.rs - sumoverfield (line 508) ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out