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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/memo rust #5

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@whatisinternet
Copy link

whatisinternet commented Oct 19, 2016

What it does:

  • Swaps inflections for inflector to increase performance
  • Adds memoization option for rust wrapped in ruby
  • Fixes up minor issues with README

Why it does it:

  • Inflector is fast now 馃槃
  • Closes #4
  • README was out of date and missing important information

whatisinternet added some commits Oct 19, 2016

Swapped out inflections for inflector and added memoization for the r鈥
鈥st/ruby implementation

The caching strategy is roughly the same as what can be seen in the
memoized ruby implementation. The key difference is that the rust
version permits the user to opt-out of memoization if the memory cost
outweighs the advantage.

The benchmarks demonstrate the advantage to this approach:

```shell
Comparison:
Memoized Rust: camel:   487388.1 i/s
         Rust: camel:   256298.5 i/s - 1.90x  slower
Memoized Ruby: camel:   182680.2 i/s - 2.67x  slower
         Ruby: camel:    11269.3 i/s - 43.25x  slower

Comparison:
Memoized Rust: camel_lower:   487505.8 i/s
   Rust: camel_lower:   259682.4 i/s - 1.88x  slower
Memoized Ruby: camel_lower:   184219.8 i/s - 2.65x  slower
   Ruby: camel_lower:     8756.9 i/s - 55.67x  slower

Comparison:
 Memoized Rust: dash:   489584.2 i/s
          Rust: dash:   251549.6 i/s - 1.95x  slower
 Memoized Ruby: dash:   184172.7 i/s - 2.66x  slower
          Ruby: dash:    20606.1 i/s - 23.76x  slower

Comparison:
Memoized Ruby: unaltered:  6250658.9 i/s
     Rust: unaltered:  6248618.4 i/s - same-ish: difference falls within error
     Ruby: unaltered:  6206613.8 i/s - same-ish: difference falls within error
Memoized Rust: unaltered:  6129025.5 i/s - same-ish: difference falls within error

Comparison:
Memoized Rust: underscore:   484669.5 i/s
    Rust: underscore:   237816.7 i/s - 2.04x  slower
Memoized Ruby: underscore:   189263.7 i/s - 2.56x  slower
    Ruby: underscore:   150186.4 i/s - 3.23x  slower
```
Updated readme with instructions in README
The readme wasn't very helpful for getting up and running
@NullVoxPopuli

This comment has been minimized.

Copy link
Owner

NullVoxPopuli commented Jul 27, 2017

I'm transitioning this project to helix at the moment. But this work won't be forgotten! It's very valuable if people can afford the memory tradeoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment