Skip to content

Conversation

@Olshansk
Copy link
Contributor

@Olshansk Olshansk commented Sep 3, 2025

tl;dr Ethereum's CGO backend delivers ~45% faster signing and ~84% faster verification than Cosmos SDK, with 90% fewer memory allocations during verification.


Benchmark outputs of this command:

make benchmark_report

Showing:

📊 Shannon SDK Benchmarks (portable vs ethereum)
🔬 Shannon SDK Benchmark Comparison
====================================

📊 Testing Portable Backend (Pure Go)

📊 Testing Ethereum Backend (libsecp256k1)

=== SDK Performance Comparison ===

Benchmark                                   Portable          Ethereum      Improvement         Δ Time        Δ %
-------------------------------------------------------------------------------------------------------------------
BenchmarkSign                                 1.7 ms            766 μs    🚀 2.2x faster       - 915 μs     -54.4%
BenchmarkSignWithCachedPrivateKey             1.8 ms            745 μs    🚀 2.4x faster       - 1.0 ms     -58.2%
BenchmarkSignLargePayload                     1.8 ms            776 μs    🚀 2.3x faster       - 980 μs     -55.8%
BenchmarkSerializeSignature                    42 μs            399 ns  🚀 104.6x faster        - 41 μs     -99.0%
BenchmarkSignCore                             1.5 ms            631 μs    🚀 2.4x faster       - 890 μs     -58.5%
BenchmarkSignReuseRing                        1.7 ms            784 μs    🚀 2.1x faster       - 888 μs     -53.1%
BenchmarkVerifyRingSignature                  1.0 ms            458 μs    🚀 2.2x faster       - 553 μs     -54.7%
BenchmarkDeserializeAndVerifyRingSignature            1.1 ms            473 μs    🚀 2.3x faster       - 597 μs     -55.8%
BenchmarkVerifyRingSignature5                 2.5 ms            1.1 ms    🚀 2.3x faster       - 1.4 ms     -55.7%
BenchmarkVerifyRingSignature10                5.1 ms            2.1 ms    🚀 2.4x faster       - 3.0 ms     -58.6%
BenchmarkVerifyRingSignature20                9.9 ms            4.2 ms    🚀 2.4x faster       - 5.7 ms     -57.8%
BenchmarkVerifyRingSignature40               20.6 ms            8.2 ms    🚀 2.5x faster      - 12.4 ms     -60.2%

Summary
  Benchmarks: 12
  Avg speedup: 10.83x
  Median speedup: 2.32x
  Avg Δ%%: -60.1%

=== Memory Usage Comparison ===

Benchmark                               Port B/op      Port Allocs         Eth B/op       Eth Allocs     Δ B/op     Δ Allocs     Δ% B    Δ% Allocs
------------------------------------------------------------------------------------------------------------------------------------------------------
BenchmarkSign                                9073              150            43108             1030     +34035         +880   +375.1%       +586.7%
BenchmarkSignWithCachedPrivateKey            8425              137            39030              898     +30605         +761   +363.3%       +555.5%
BenchmarkSignLargePayload                   19827              150            54090             1058     +34263         +908   +172.8%       +605.3%
BenchmarkSerializeSignature                   968               11              968               11         +0           +0     +0.0%         +0.0%
BenchmarkSignCore                            5977               95            23070              376     +17093         +281   +286.0%       +295.8%
BenchmarkSignReuseRing                       9073              150            43448             1072     +34375         +922   +378.9%       +614.7%
BenchmarkVerifyRingSignature                 3392               53            19172              299     +15780         +246   +465.2%       +464.2%
BenchmarkDeserializeAndVerifyRingSignature           4512               77            30335              676     +25823         +599   +572.3%       +777.9%
BenchmarkVerifyRingSignature5                8480              131            47730              744     +39250         +613   +462.9%       +467.9%
BenchmarkVerifyRingSignature10              16961              261            95588             1489     +78627        +1228   +463.6%       +470.5%
BenchmarkVerifyRingSignature20              33920              521           191145             2976    +157225        +2455   +463.5%       +471.2%
BenchmarkVerifyRingSignature40              67904             1041           382960             5959    +315056        +4918   +464.0%       +472.4%

@Olshansk Olshansk self-assigned this Sep 3, 2025
@Olshansk Olshansk added this to Shannon Sep 18, 2025
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Shannon Sep 18, 2025
@Olshansk Olshansk moved this from 📋 Backlog to 👀 In review in Shannon Sep 18, 2025
@Olshansk Olshansk changed the title [WIP] Signature optimization [Performance] Add CGO as an option for performance optimization Sep 19, 2025
@Olshansk Olshansk marked this pull request as ready for review September 19, 2025 23:44
@Olshansk Olshansk merged commit b721a00 into main Sep 26, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Shannon Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants