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

test: add zuc128_benchmark #7

Merged
merged 4 commits into from
Dec 16, 2024
Merged

test: add zuc128_benchmark #7

merged 4 commits into from
Dec 16, 2024

Conversation

pai2shub
Copy link
Contributor

No description provided.

@pai2shub pai2shub mentioned this pull request Dec 16, 2024
7 tasks
Copy link
Owner

@Nugine Nugine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 可以仅用 Example3 的 key 和 iv 初始化,不需要重复这些 example 数据
  • 使用 criterion 的吞吐测量功能
  • 使用 bench_with_input,分别测量 1000,2000,3000,10000,20000,30000 次 generate 的耗时

最终需要能看到 zuc128 generate 的吞吐性能 (bytes per second)。
注意:每次 generate 生成 u32 (4 bytes)。

用 black_box 避免某些调用被优化删除
https://docs.rs/criterion/latest/criterion/fn.black_box.html

@pai2shub
Copy link
Contributor Author

Running benches\zuc128_benchmark output

Gnuplot not found, using plotters backend
zuc128_generate_throughput/1000
                        time:   [7.0246 µs 7.0607 µs 7.1039 µs]
                        thrpt:  [536.99 MiB/s 540.27 MiB/s 543.05 MiB/s]
                 change:
                        time:   [-3.4192% -2.7769% -2.0803%] (p = 0.00 < 0.05)
                        thrpt:  [+2.1245% +2.8562% +3.5403%]
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
zuc128_generate_throughput/2000
                        time:   [13.960 µs 14.010 µs 14.063 µs]
                        thrpt:  [542.51 MiB/s 544.57 MiB/s 546.51 MiB/s]
                 change:
                        time:   [-3.5995% -3.0574% -2.4854%] (p = 0.00 < 0.05)
                        thrpt:  [+2.5488% +3.1538% +3.7339%]
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
zuc128_generate_throughput/3000
                        time:   [21.396 µs 21.556 µs 21.724 µs]
                        thrpt:  [526.79 MiB/s 530.89 MiB/s 534.88 MiB/s]
                 change:
                        time:   [-3.3541% -2.5523% -1.7863%] (p = 0.00 < 0.05)
                        thrpt:  [+1.8188% +2.6192% +3.4705%]
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
zuc128_generate_throughput/10000
                        time:   [72.835 µs 73.622 µs 74.495 µs]
                        thrpt:  [512.07 MiB/s 518.14 MiB/s 523.75 MiB/s]
                 change:
                        time:   [+0.6526% +2.5603% +5.2247%] (p = 0.02 < 0.05)
                        thrpt:  [-4.9653% -2.4964% -0.6484%]
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
zuc128_generate_throughput/20000
                        time:   [147.13 µs 147.76 µs 148.44 µs]
                        thrpt:  [513.98 MiB/s 516.34 MiB/s 518.54 MiB/s]
                 change:
                        time:   [-2.3143% -1.5925% -0.9274%] (p = 0.00 < 0.05)
                        thrpt:  [+0.9361% +1.6183% +2.3691%]
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
zuc128_generate_throughput/30000
                        time:   [219.27 µs 220.23 µs 221.24 µs]
                        thrpt:  [517.27 MiB/s 519.64 MiB/s 521.91 MiB/s]
                 change:
                        time:   [-1.9726% -1.5208% -1.0746%] (p = 0.00 < 0.05)
                        thrpt:  [+1.0863% +1.5442% +2.0122%]
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

benches/zuc128_benchmark.rs Outdated Show resolved Hide resolved
benches/zuc128_benchmark.rs Outdated Show resolved Hide resolved
@Nugine
Copy link
Owner

Nugine commented Dec 16, 2024

看下 CI 报错,修完即可合并

@Nugine Nugine merged commit 62d4edc into Nugine:main Dec 16, 2024
3 checks passed
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.

2 participants