RustCrypto / RustCrypto/crypto-bigint

Possible inlining improvements

Open
#981 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
309
Forks
95
Avg merge
1d 14h
Merged PRs (30d)
3

Description

I ran RUSTFLAGS=-Ccodegen-units=1 cargo bench to see what changed versus just cargo bench. There were a few that stuck out in particular:

  • wrapping ops/widening_mul
    • I512xI512: -25%
    • I1024xI1024: -4%
  • widening ops/concatenating_mul
    • I128xI128: −18%
    • I512xI512: −31%
  • wrapping ops/sub
    • I512-I512: −35%
    • I1024-I1024: −25%
  • bounded random/random_mod
    • U1024: -11%
    • U1024 tiny high limb: -9%
  • wrapping ops/widening_mul
    • U256xU256: -12%
  • wrapping ops/mul_mod_special
    • U256: -10%
  • extended greatest common divisor/xgcd
    • 1: -3%
    • 2: -3%
    • 3: -2%
    • 5: -23%
    • 6: -16%
    • 7: -18%
    • 8: -5%
    • 16: -22%
    • 32: -16%
    • 128: -8%
    • 256: -5%
  • left shift/shl_vartime
    • small, U2048: -40%
    • large, U2048: -41%
  • left shift/shl_vartime_wide
    • large, U2048: -22%
  • right shift/shr
    • U2048: -8%
  • right shift/shr_vartime_wide
    • large, U2048: -24%
  • modular ops/invert_mod2k_vartime
    • U256: -18%

cc @andrewwhitehead @erik-3milabs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running RUSTFLAGS=-Ccodegen-units=1 cargo bench and compare it with cargo bench, focusing on the listed benchmark groups such as widening_mul, shl_vartime, xgcd, and invert_mod2k_vartime. Trace those operations to their implementations and benchmark coverage; done means identifying and addressing justified inlining improvements while confirming the relevant benchmark results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.