Abdel on Nostr: Managed to beat the Rust implementation with a Zig implementation ⚡️ Initially it ...
Managed to beat the Rust implementation with a Zig implementation ⚡️
Initially it was slower, but, moving to use the same libsec256k1 C implementation for operations on SECP256k1 curve, now the Zig version is slightly faster.
113 micro seconds for the End to End BDHKE!
Zig is fast ⚡
Me today: write BDHKE scheme in Zig (https://github.com/AbdelStark/coconut).
Benchmark it: Oh wow it's super fast, 1 millisecond for the end to end scheme.
Find the Rust implementation (https://github.com/ngutech21/moksha) and benchmark it: it's about 10 times faster than my Zig implementation 😭
Gg Moksha folks! 🦀 is blazingly fast damn.
I suspect there might be a gap in terms of performance between the Secp256k1 implementation of the Zig std lib and the C implementation (the secp256k1 crate being a Rust wrapper library for Pieter Wuille's libsecp256k1 in C).
Zig benchmark:
Rut benchmark:
Published at
2024-08-09 11:52:55Event JSON
{
"id": "eef627f286ce76cd6661dc587fb2bcd67fca0c2630ddd8bfe5f5544c0042e9c0",
"pubkey": "b8f4c2e90f0dd667121533d7b8dafd77384b0b5051f8272e5493c58f7f93e14b",
"created_at": 1723204375,
"kind": 1,
"tags": [],
"content": "Managed to beat the Rust implementation with a Zig implementation ⚡️\nInitially it was slower, but, moving to use the same libsec256k1 C implementation for operations on SECP256k1 curve, now the Zig version is slightly faster.\n113 micro seconds for the End to End BDHKE!\n\nZig is fast ⚡\n\nnostr:note1xjwgawu8jnv3m9twle9f2h7hpf58txacdvasfdhpcc9hahezycks5jsdxj",
"sig": "5d7962e162ebeeedc5593fe8916ddc959bec8535ebc750befa1a3ed3be1b0d07bb9382ff437ae57b308c0e485418e775c1ea7097e4b569ee79a3e7e0b1129f5e"
}