Skip to content

COSE performance comparison#7759

Closed
achamayou wants to merge 2 commits into
mainfrom
cose_comparison
Closed

COSE performance comparison#7759
achamayou wants to merge 2 commits into
mainfrom
cose_comparison

Conversation

@achamayou

@achamayou achamayou commented Mar 24, 2026

Copy link
Copy Markdown
Member

Current main:

(.venv) root [ /workspaces/CCF/build ]# ./cose_bench 
## cose sign secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_256r1_1byte *       |      10 |     1.510 |  151036 |      - |     6620.9
 sign_256r1_1k            |      10 |     1.510 |  150980 |  1.000 |     6623.4
 sign_256r1_100k          |      10 |     2.241 |  224080 |  1.484 |     4462.7

## cose sign secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_384r1_1byte *       |      10 |     3.106 |  310640 |      - |     3219.2
 sign_384r1_1k            |      10 |     3.119 |  311920 |  1.004 |     3205.9
 sign_384r1_100k          |      10 |     5.236 |  523632 |  1.686 |     1909.7

## cose verify secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_256r1_1byte *     |      10 |     1.389 |  138909 |      - |     7198.9
 verify_256r1_1k          |      10 |     1.393 |  139250 |  1.002 |     7181.3
 verify_256r1_100k        |      10 |     2.142 |  214241 |  1.542 |     4667.6

## cose verify secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_384r1_1byte *     |      10 |     3.004 |  300415 |      - |     3328.7
 verify_384r1_1k          |      10 |     3.006 |  300574 |  1.001 |     3327.0
 verify_384r1_100k        |      10 |     5.128 |  512844 |  1.707 |     1949.9

@achamayou

achamayou commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

With #7734 changes (https://github.com/microsoft/CCF/tree/rust_vs_cpp_cose_perf_experiment):

.venv) root [ /workspaces/CCF/build ]# ./cose_bench
## cose sign secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_256r1_1byte *       |      10 |     1.628 |  162774 |      - |     6143.5
 sign_256r1_1k            |      10 |     1.628 |  162781 |  1.000 |     6143.2
 sign_256r1_100k          |      10 |     2.431 |  243102 |  1.493 |     4113.5

## cose sign secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_384r1_1byte *       |      10 |     3.387 |  338681 |      - |     2952.6
 sign_384r1_1k            |      10 |     3.418 |  341812 |  1.009 |     2925.6
 sign_384r1_100k          |      10 |     5.669 |  566938 |  1.674 |     1763.9

## cose verify secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_256r1_1byte *     |      10 |     1.931 |  193097 |      - |     5178.7
 verify_256r1_1k          |      10 |     1.896 |  189638 |  0.982 |     5273.2
 verify_256r1_100k        |      10 |     2.685 |  268475 |  1.390 |     3724.7

## cose verify secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_384r1_1byte *     |      10 |     4.021 |  402139 |      - |     2486.7
 verify_384r1_1k          |      10 |     4.125 |  412532 |  1.026 |     2424.0
 verify_384r1_100k        |      10 |     6.382 |  638161 |  1.587 |     1567.0

@achamayou

Copy link
Copy Markdown
Member Author
 Benchmark          | C++ (ops/s) | Rust FFI (ops/s) | Change
--------------------|-------------|------------------|-------
 sign_256r1_1byte   |      6620.9 |           6143.5 |  -7.2%
 sign_256r1_1k      |      6623.4 |           6143.2 |  -7.2%
 sign_256r1_100k    |      4462.7 |           4113.5 |  -7.8%
 sign_384r1_1byte   |      3219.2 |           2952.6 |  -8.3%
 sign_384r1_1k      |      3205.9 |           2925.6 |  -8.7%
 sign_384r1_100k    |      1909.7 |           1763.9 |  -7.6%
 verify_256r1_1byte |      7198.9 |           5178.7 | -28.1%
 verify_256r1_1k    |      7181.3 |           5273.2 | -26.6%
 verify_256r1_100k  |      4667.6 |           3724.7 | -20.2%
 verify_384r1_1byte |      3328.7 |           2486.7 | -25.3%
 verify_384r1_1k    |      3327.0 |           2424.0 | -27.1%
 verify_384r1_100k  |      1949.9 |           1567.0 | -19.6%

@achamayou

Copy link
Copy Markdown
Member Author

The headers were a little different, I updated the C++ side, but the gap remains very similar:

## cose sign secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_256r1_1byte *       |      10 |     1.516 |  151562 |      - |     6598.0
 sign_256r1_1k            |      10 |     1.516 |  151552 |  1.000 |     6598.4
 sign_256r1_100k          |      10 |     2.259 |  225865 |  1.490 |     4427.4

## cose sign secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 sign_384r1_1byte *       |      10 |     3.126 |  312550 |      - |     3199.5
 sign_384r1_1k            |      10 |     3.115 |  311485 |  0.997 |     3210.4
 sign_384r1_100k          |      10 |     5.247 |  524660 |  1.679 |     1906.0

## cose verify secp256r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_256r1_1byte *     |      10 |     1.422 |  142235 |      - |     7030.6
 verify_256r1_1k          |      10 |     1.435 |  143506 |  1.009 |     6968.3
 verify_256r1_100k        |      10 |     2.143 |  214319 |  1.507 |     4665.9

## cose verify secp384r1:

 Name (* = baseline)      |   Dim   |  Total ms |  ns/op  |Baseline| Ops/second
--------------------------|--------:|----------:|--------:|-------:|----------:
 verify_384r1_1byte *     |      10 |     3.010 |  301037 |      - |     3321.8
 verify_384r1_1k          |      10 |     3.020 |  301956 |  1.003 |     3311.7
 verify_384r1_100k        |      10 |     5.163 |  516317 |  1.715 |     1936.8

@achamayou achamayou changed the title COSE comparison COSE performance comparison Mar 24, 2026
@achamayou

Copy link
Copy Markdown
Member Author

@maxtropets to be addressed post #7734

@achamayou achamayou closed this Mar 24, 2026
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.

1 participant