Skip to content

Encoder compress performance #61

Description

@Slixe

Hey there!

I don't know if I should do a PR or not because it's kinda weird:
https://github.com/BurntSushi/rust-snappy/blob/master/src/compress.rs#L514
could be simply replaced by a table.fill(0); and give some performance boost in some cases
but also being slower on others benchs.

Here is an idea of results with this change (few examples, not all):

snap/compress/zflat02_jpg/123093                                                                            
                        time:   [3.4687 µs 3.4811 µs 3.4970 µs]
                        thrpt:  [32.782 GiB/s 32.931 GiB/s 33.050 GiB/s]
                 change:
                        time:   [-12.804% -11.879% -11.104%] (p = 0.00 < 0.05)
                        thrpt:  [+12.491% +13.480% +14.684%]
                        Performance has improved.
Found 2 outliers among 50 measurements (4.00%)
  1 (2.00%) high mild
  1 (2.00%) high severe
...
snap/compress/zflat08_txt3/426754                                                                            
                        time:   [826.13 µs 829.73 µs 834.85 µs]
                        thrpt:  [487.49 MiB/s 490.50 MiB/s 492.64 MiB/s]
                 change:
                        time:   [+3.8076% +4.4894% +5.2353%] (p = 0.00 < 0.05)
                        thrpt:  [-4.9749% -4.2965% -3.6679%]
                        Performance has regressed.

but there is side effects on decompress?

snap/decompress/uflat03_jpg_200/200                                                                           
                        time:   [114.52 ns 115.63 ns 116.80 ns]
                        thrpt:  [1.5947 GiB/s 1.6108 GiB/s 1.6265 GiB/s]
                 change:
                        time:   [-4.5188% -3.5631% -2.6538%] (p = 0.00 < 0.05)
                        thrpt:  [+2.7262% +3.6947% +4.7326%]
                        Performance has improved.

snap/decompress/uflat04_pdf/102400                                                                            
                        time:   [3.0975 µs 3.1150 µs 3.1403 µs]
                        thrpt:  [30.369 GiB/s 30.615 GiB/s 30.789 GiB/s]
                 change:
                        time:   [-8.6944% -7.3807% -6.3959%] (p = 0.00 < 0.05)
                        thrpt:  [+6.8329% +7.9688% +9.5223%]
                        Performance has improved.
Found 3 outliers among 50 measurements (6.00%)
  3 (6.00%) high severe
...
snap/decompress/uflat10_pb/118588                                                                            
                        time:   [15.782 µs 15.806 µs 15.833 µs]
                        thrpt:  [6.9757 GiB/s 6.9875 GiB/s 6.9982 GiB/s]
                 change:
                        time:   [+3.0507% +3.3915% +3.6961%] (p = 0.00 < 0.05)
                        thrpt:  [-3.5643% -3.2803% -2.9604%]
                        Performance has regressed.

Not sure what I miss, and if its really worth it to make such change

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions