algebra
algebra copied to clipboard
Ark-ec pulls in full hashbrown without feature gate
That eventually pulls things like once_cell that require atomics on some platforms (compare-exchange), and in general HashMap is quite heavy primitive that is still not in alloc of Rust itself
Full hashbrown is pulled in
- https://github.com/arkworks-rs/algebra/blob/bb663bc27e776af81e66c94d9016bde2dbba9968/ec/src/scalar_mul/variable_base/stream_pippenger.rs#L5 - for peppinger - can be solved by feature gate. Independently, do you think unordered map wins here performance-wise vs ordered (a-la BTree)?
- https://github.com/arkworks-rs/algebra/blob/bb663bc27e776af81e66c94d9016bde2dbba9968/ec/src/hashing/curve_maps/swu.rs#L154 - in test, dev-dependencies will just work
- https://github.com/arkworks-rs/algebra/blob/bb663bc27e776af81e66c94d9016bde2dbba9968/ec/src/hashing/curve_maps/elligator2.rs#L161 - same, tests only
Let me check how to replace the HashMap in stream_pippenger. (there should be other ways to get no-std hash map).
For the other two, easy.
We can drop once_cell by removing the ahash feature from hashbrown.
I patched it via feature in ec and poly packages, everything works except benchmarks that can not specify features (cargo limitations...). Don't know much about internals of hashbrown to comment on proposed alternative to factor out it's dependency instead
Do you think if once_cell is no longer a dependency, would it still be a problem?
https://github.com/arkworks-rs/algebra/commit/f46193b74a6f51299dcc3d835cf6694c28af99f9 Let me know your thoughts. But clearly if I can remove a dependency, it is better.
On once-cell I'll need to check, I'll try to turn it off using hashbrown features in my local copy and build tomorrow