150
To steal a song from [Olaf](https://static.wikia.nocookie.net/disney/images/5/53/Profile_-_Olaf.jpeg...
since 3 years, 1 month ago
11 of 11
Tip Reveddit Real-Time can notify you when your content is removed.
your account history
Tip Check if your account has any removed comments.
view my removed comments you are viewing a single comment's thread.
view all comments


Rust Quick and simple.
Part 1 0.027ms (27 μs)
Part 2 0.031ms (31 μs)
day01 total: 0.058 ms (58 μs)
I found out that
trim().split("\n")is a few μs faster thanlines()on my machine ... you might be able to get that a few μs faster :)Beautiful.
Maybe I have the dumb, but running this I get an error:
Doesn’t seem to like the first unwrap, do you have any idea why?
Edit: it doesn't like split("\n\n"), the inputs are directly off the site with no apparent leading or trailing whitespace, using split_whitespace() no longer errors but obviously the result is incorrect.
Did you copy and paste the input on a Windows machine? It’ll add a carriage return if you’re not careful
I did although \r\n\n also doesn't work and \r\n (obviously) gives the false result I also get with split_whitespace.
First time playing with rust in any real way.
/r/n/r/n
This isn’t a Rust thing, just a *nix vs. Windows thing
Oops, slashes are the wrong direction but I don’t want to find it on my phone 😁
Yeah, cheers mate.
Time to go back to scraping the input, or just using a nix os.
Try save as in the browser instead of cut/paste
Please see https://github.com/timvisee/advent-of-code-2022#timings
It's the best time out of 100 runs, without binary loading overhead from the kernel. Not very scientific.