projectfluent / fluent-rs

Rust implementation of Project Fluent
https://projectfluent.org
Apache License 2.0
1.07k stars 96 forks source link

Use smallvec for scope tracking #118

Closed Manishearth closed 5 years ago

Manishearth commented 5 years ago

I seem to see improvements in the benchmarks, but my results seem to swing wildly.

Worth checking yourself first.

r? @zbraniecki

Manishearth commented 5 years ago

This does make Scope one byte bigger. However, it's stored on the stack, so this doesn't really matter. In fact we could probably make this into a 4-element SmallVec and still win.

The compiler probably is able to fast-path the two-element case, too.

zbraniecki commented 5 years ago

Yep, definitely a nice improvement in the one test that's affected by the tracing (preferences):

Gnuplot not found, disabling plotting
resolve/"simple"        time:   [9.3731 us 9.4333 us 9.4966 us]                              
                        change: [+0.4569% +1.7164% +2.9955%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) high mild
  5 (5.00%) high severe
resolve/"preferences"   time:   [103.70 us 104.21 us 104.72 us]                                  
                        change: [-11.756% -11.077% -10.394%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
resolve/"menubar"       time:   [26.571 us 26.828 us 27.101 us]                               
                        change: [-2.2364% -1.3536% -0.4172%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
resolve/"unescape"      time:   [1.7138 us 1.7233 us 1.7356 us]                                
                        change: [-10.769% -9.5668% -8.2277%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) high mild
  5 (5.00%) high severe

Gnuplot not found, disabling plotting
zbraniecki commented 5 years ago

Thank you