snipsco / snips-nlu-rs

Snips NLU rust implementation
https://snips.ai
Other
340 stars 56 forks source link

Update serialization and resources management #58

Closed adrienball closed 6 years ago

adrienball commented 6 years ago

Description This PR introduces a completely redesigned way to manage and load resources. There are now loaded dynamically, based on the content of the trained engine directory (which used to be a single json file), instead of being statically hardcoded.

This has several advantages:

It comes with some drawbacks though:

This is the benchmark I ran on my laptop (MacBook Pro 2017 Core i7) on a medium-size weather dataset:

New serialization & resources management
----------------------------------------
test nlu_loading ... bench: 163,866,780 ns/iter (+/- 6,099,507)
test nlu_parsing ... bench:   4,210,047 ns/iter (+/- 886,156)

cargo build --all  585.62s user 32.24s system 248% cpu 4:08.74 total
cargo build --all --release  1920.03s user 42.25s system 305% cpu 10:42.49 total

memory 42.3 Mb

$ ll target/release/snips-nlu-cli
-rwxr-xr-x  2 adrien  staff    25M Jul 12 15:06 target/release/snips-nlu-cli

Previous (0.57.1)
-----------------
test nlu_loading ... bench:  89,731,218 ns/iter (+/- 5,837,671)
test nlu_parsing ... bench:   2,485,156 ns/iter (+/- 702,864)

cargo build --all  1283.53s user 36.86s system 156% cpu 14:01.98 total
cargo build --all --release  2016.45s user 48.77s system 323% cpu 10:37.64 total

$ ll target/release/snips-nlu-cli
-rwxr-xr-x  2 adrien  staff    56M Jul 12 15:07 target/release/snips-nlu-cli

Here are the details of the PR:

klefevre commented 6 years ago

👨‍🎨