top | item 46437518 (no title) eolpin | 2 months ago Fortunately this hack isn't necessary for rust, shebangs are syntactically valid and single-file scripts can be executed with cargo nightly: https://doc.rust-lang.org/nightly/cargo/reference/unstable.h... discuss order hn newest jswny|2 months ago I wish this was faster, in my tests it’s about 200ms startup consistently on my M4 MacBook. Otherwise very cool eolpin|2 months ago Interesting! That seems unexpected, for a minimal hello-world program I'm averaging 14ms after the first execution:```$ echo 'fn main() { println!("hello, world!") }' > file.rs; hyperfine --warmup 1 'cargo +nightly -Zscript file.rs'Benchmark 1: cargo +nightly -Zscript file.rs Time (mean ± σ): 14.0 ms ± 1.0 ms [User: 7.7 ms, System: 9.7 ms] Range (min … max): 12.2 ms … 17.5 ms 203 runs ``` load replies (1) dherman|2 months ago Cool!
jswny|2 months ago I wish this was faster, in my tests it’s about 200ms startup consistently on my M4 MacBook. Otherwise very cool eolpin|2 months ago Interesting! That seems unexpected, for a minimal hello-world program I'm averaging 14ms after the first execution:```$ echo 'fn main() { println!("hello, world!") }' > file.rs; hyperfine --warmup 1 'cargo +nightly -Zscript file.rs'Benchmark 1: cargo +nightly -Zscript file.rs Time (mean ± σ): 14.0 ms ± 1.0 ms [User: 7.7 ms, System: 9.7 ms] Range (min … max): 12.2 ms … 17.5 ms 203 runs ``` load replies (1)
eolpin|2 months ago Interesting! That seems unexpected, for a minimal hello-world program I'm averaging 14ms after the first execution:```$ echo 'fn main() { println!("hello, world!") }' > file.rs; hyperfine --warmup 1 'cargo +nightly -Zscript file.rs'Benchmark 1: cargo +nightly -Zscript file.rs Time (mean ± σ): 14.0 ms ± 1.0 ms [User: 7.7 ms, System: 9.7 ms] Range (min … max): 12.2 ms … 17.5 ms 203 runs ``` load replies (1)
jswny|2 months ago
eolpin|2 months ago
```
$ echo 'fn main() { println!("hello, world!") }' > file.rs; hyperfine --warmup 1 'cargo +nightly -Zscript file.rs'
Benchmark 1: cargo +nightly -Zscript file.rs
```dherman|2 months ago