CertainLach/jrsonnet

jrsonnet-stdlib takes very long time to build?

Closed this issue · 2 comments

iwinux commented

Regardless of the shitty MacBook Pro that I'm using, jrsonnet-stdlib ranks the slowest crate in cargo build timings. It spends 90+% of the build time on codegen, which seems related to the codegenerated-stdlib feature?

Env

  • CPU: Intel i5-1038NG7 (8) @ 2.00GHz
  • Rust 1.71.1 (eb26296b5 2023-08-03)
  • Host: x86_64-apple-darwin
  • Target: x86_64-apple-darwin
  • jrsonnet-stdlib v0.5.0-pre95

Build

cargo clean
cargo build --release --timings

With Feature codegenerated-stdlib

image image

Without Feature codegenerated-stdlib

[dependencies.jrsonnet-stdlib]
version = "0.5.0-pre95"
default-features = false
features = ["exp-preserve-order"]
image image

Previously, codegenerated-stdlib caused huge startup speedups.

Not much nowadays, as most of the standard library has been moved to native code (https://github.com/CertainLach/jrsonnet/blob/master/crates/jrsonnet-stdlib/src/std.jsonnet), but it's still better than parsing it every time.

I think this is normal, because it generates very large function, which llvm tries (and succeeds) to optimize a lot.
I would prefer to keep stdlib to be codegenerated by default (You can always disable default-features), until it is fully converted to Rust.

iwinux commented

Understood. Thank you!