Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super fast XOR #77

Merged
merged 1 commit into from
Apr 29, 2019
Merged

Super fast XOR #77

merged 1 commit into from
Apr 29, 2019

Conversation

nhooyr
Copy link
Contributor

@nhooyr nhooyr commented Apr 29, 2019

Closes #76

benchmark                      old ns/op     new ns/op     delta
BenchmarkXOR/2/basic-2         5.43          5.46          +0.55%
BenchmarkXOR/2/fast-2          6.42          6.39          -0.47%
BenchmarkXOR/16/basic-2        17.0          17.1          +0.59%
BenchmarkXOR/16/fast-2         17.7          16.6          -6.21%
BenchmarkXOR/32/basic-2        30.6          30.7          +0.33%
BenchmarkXOR/32/fast-2         19.3          17.8          -7.77%
BenchmarkXOR/512/basic-2       448           445           -0.67%
BenchmarkXOR/512/fast-2        98.7          61.2          -37.99%
BenchmarkXOR/4096/basic-2      3487          3498          +0.32%
BenchmarkXOR/4096/fast-2       697           379           -45.62%
BenchmarkXOR/16384/basic-2     13894         13952         +0.42%
BenchmarkXOR/16384/fast-2      2738          1475          -46.13%

benchmark                      old MB/s     new MB/s     speedup
BenchmarkXOR/2/basic-2         368.43       365.98       0.99x
BenchmarkXOR/2/fast-2          311.55       313.15       1.01x
BenchmarkXOR/16/basic-2        941.21       935.48       0.99x
BenchmarkXOR/16/fast-2         901.42       962.22       1.07x
BenchmarkXOR/32/basic-2        1044.65      1041.27      1.00x
BenchmarkXOR/32/fast-2         1654.63      1802.62      1.09x
BenchmarkXOR/512/basic-2       1142.53      1149.90      1.01x
BenchmarkXOR/512/fast-2        5188.32      8368.92      1.61x
BenchmarkXOR/4096/basic-2      1174.33      1170.82      1.00x
BenchmarkXOR/4096/fast-2       5875.49      10802.77     1.84x
BenchmarkXOR/16384/basic-2     1179.14      1174.24      1.00x
BenchmarkXOR/16384/fast-2      5982.73      11104.28     1.86x

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

Merging #77 into master will increase coverage by 0.45%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
+ Coverage    81.9%   82.35%   +0.45%     
==========================================
  Files          10       10              
  Lines         663      697      +34     
==========================================
+ Hits          543      574      +31     
- Misses        100      102       +2     
- Partials       20       21       +1
Impacted Files Coverage Δ
xor.go 100% <100%> (ø) ⬆️
websocket.go 82.94% <0%> (-0.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edbaaeb...148ee0d. Read the comment docs.

@nhooyr
Copy link
Contributor Author

nhooyr commented Apr 29, 2019

Need to ask why the for loops work but if statements after the 128 byte for loop slows things down to a crawl.

@nhooyr nhooyr merged commit 3db4c88 into master Apr 29, 2019
@nhooyr nhooyr deleted the fastxor branch April 29, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize xor function further
1 participant