Skip to content

Apply #[inline]/[cold]/[never] per hot-path rules (#339)#376

Closed
joaquinbejar wants to merge 3 commits into
mainfrom
issue-339-compiler-attributes
Closed

Apply #[inline]/[cold]/[never] per hot-path rules (#339)#376
joaquinbejar wants to merge 3 commits into
mainfrom
issue-339-compiler-attributes

Conversation

@joaquinbejar
Copy link
Copy Markdown
Owner

…#339)

- `#[inline]` on hot-path public entry points and small accessors in
  `strategies/*`, `pnl/*`, `greeks/utils`, `pricing/{payoff,utils}`,
  `risk/span`, `volatility/utils`, etc. following the audit in
  `rules/global_rules.md` §Compiler Attributes.
- `#[inline(never)]` on large / rarely-taken constructors such as
  `CustomStrategy::new` and other multi-arg builders that the optimiser
  has no business inlining.
- `#[cold] #[inline(never)]` on every error constructor across `error/*`
  (`DecimalError::{overflow, arithmetic_error, conversion_error,
  out_of_bounds, invalid_precision, invalid_value}`,
  `PricingError::{method_error, simulation_error, invalid_engine,
  other, unsupported_option_type, non_finite}`, and the equivalents in
  `greeks`, `volatility`, `simulation`, `strategies`, `options`,
  `position`, `probability`, `chains`, `curves`, `surfaces`, `trade`)
  so panic / error paths don't pollute the inlining budget of the
  happy path.

`#[inline(always)]` intentionally _not_ added here: the rules require
a Criterion benchmark demonstrating the win first. That audit is
tracked by the benchmark work on numeric kernels and will land in a
follow-up PR.

Closes #339
@joaquinbejar joaquinbejar added enhancement New feature or request performance Performance optimization labels Apr 19, 2026
@joaquinbejar joaquinbejar self-assigned this Apr 19, 2026
@joaquinbejar
Copy link
Copy Markdown
Owner Author

@copilot review

Copy link
Copy Markdown

Copilot AI commented Apr 19, 2026

@copilot review

Reviewed the last 3 commits on this branch and ran baseline validation in this environment. No actionable issues were found in the inline/cold attribute changes, so no additional code changes were needed. Current head: 7946ea6.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /home/REDACTED/work/OptionStratLib/OptionStratLib/target/debug/build/plotly_static-ca6e75c2058d1af9/build-script-build /home/REDACTED/work/OptionStratLib/OptionStratLib/target/debug/build/plotly_static-ca6e75c2058d1af9/build-script-build -std=c11 -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.4/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/librustc_demangle-789fb9c0cb1c7158.rlib -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.4/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libhashbrown-70305b2ec0766fa6.rlib -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.4/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libminiz_oxide-2b6a8d2f6e1dc71b.rlib -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.40.0/�� -I /home/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/aws-lc-sys-0.40.0/aws-lc/third_party/s2n-bignum/s2n-bignum-imported/include -194�� 1c1e872ae9de9f/out/b0fd2550ab09b04e-rsa_print.o 0.0/generated-include f/aws-lc-sys-0.4-fno-omit-frame-pointer 0.0/include 811218b7-cgu.0.rcgu.o cgu.o f/aws-lc-sys-0.4-fdata-sections (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request performance Performance optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants