3 ms·
Interested by your rust speed approaches, care to share a link ?
by makapuf 2y ago
Interested by your rust speed approaches, care to share a link ?
- whalesalad 2y agoSame. I am doing rust + clojure this year. Very interested in performance hax, esp around SIMD. I know absolutely nothing at all about rust, this is my first time working with it. My day 1 rust solution: cargo solve 1 -- release Finished `release` profile [optimized] target(s) in 0.05s Running `target/release/01` Part 1: 1189304 (95.8µs) Part 2: 24349736 (120.4µs) Day 1 clojure solution: lein run 1 running all tasks for day 1 reading input from resources/day01.txt running day 1 part 1 part-fn: #'aoc.day-01/part-1 took: 5.511375 ms result: 1189304 reading input from resources/day01.txt running day 1 part 2 part-fn: #'aoc.day-01/part-2 took: 1.822334 ms result: 243497365 Code here: https://github.com/whalesalad/aoc https://github.com/whalesalad/aoc
- jodrellblank 2y agoThere's a Rust solution posted in the Reddit Day 1 answers mega thread which claims 22 microseconds part 1 and 10 microseconds part 2. (I haven't tried to verify): https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_day_1_solutions/lzv90g1/ https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_...
- surajrmal 2y agoSure but how long did it take to compile
- jodrellblank 2y agoI 'git clone' and 'cargo run' and it downloaded 16 crates and compiled all the crates and built a debug version in 29.7 seconds. Then 'cargo build --release' took 23.3 seconds. Commenting out one of the sort_unstable lines and rebuilding gave me a warning, recompiled in 1.8 seconds.
- jodrellblank 2y agoCan't edit my comment, here's another claiming 12.7 μs and 7 μs: https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_day_1_solutions/lzykfxp/ https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_... Another claiming 30μs and 32μs: https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_day_1_solutions/lzydegd/ https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_...
- dzaima 2y agoFor an interesting comparison, here's BQN, an array language, at 25.5μs (on an i3-4160) for both parts, including input parsing: https://github.com/dzaima/aoc/blob/master/2024/BQN/1_fast.bqn https://github.com/dzaima/aoc/blob/master/2024/BQN/1_fast.bq...
- jodrellblank 2y agoThat's very impressive.
- zelphirkalt 2y agoAre the timings with language runtime startup, or only the procedure calls of the actual code?
- whalesalad 2y agoJust the individual part1 and part2 functions. At least on the Clojure side, I made the runner. For the rust side I’m not sure I’m using a template project that does that containment.
- ashellunts 2y agoI do AoC first time and use it to try a functional LISP like language (Clojure). Though it is just a beginning and maybe it is a matter of habit,but I should say, that reading LISP family language is so difficult for my brain.
- whalesalad 2y agoIt takes a while. But if you continue to practice, it will eventually click.