Closed Th0rgal closed 2 weeks ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
raito | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 17, 2024 7:45am |
Thank you! We can probably remove shr/shl/fast_pow since they are no longer in use, wdyt @maciejka ?
Thank you! We can probably remove shr/shl/fast_pow since they are no longer in use, wdyt @maciejka ?
Agree.
Thank you! We can probably remove shr/shl/fast_pow since they are no longer in use, wdyt @maciejka ?
Agree.
Will do for shr. For shl I didn't update it yet (I need to think about the best way to do it because it is used to compute the target). I will probably make another pr specifically for bits_to_target
(I already have a few ideas to optimize it), and remove shl and fast_pow if possible.
This PR addresses the optimization tasks outlined in issue #[268]. The goal is to reduce computational steps in raito through the use of lookup tables and type-specific optimizations.
Changes implemented:
Performance improvements:
For the
next_power_of_two
function:test utils::numeric::tests::test_u64_next_power_of_two ... ok (gas usage est.: 1984226)
test utils::numeric::tests::test_u64_next_power_of_two ... ok (gas usage est.: 417386)
This represents a significant reduction in gas usage of approximately 80% for
next_power_of_two
, it also improves the computation of the target from bits (tricks explained in comments) which should speedupvalidate_bits
and thus the whole validation pipeline.