frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Revisiting Loop Recognition in C++ in Rust

https://blomqu.ist/posts/2025/loop-recognition/
27•todsacerdoti•5d ago

Comments

pjmlp•1d ago
I was expecting that the C++ code would have been updated to C++23 best practices, and what are all those std::list doing in modern CPU cache lines?
npalli•1d ago
Not only is it not C++23, the C++ code is from the 2011 paper!, so pre-C++11. Rust maybe better than code written before C++11 is not a strong take.
pjmlp•1d ago
Yes it has a pretty much C++98/C++ARM feeling to the code style.
quietbritishjim•1d ago
In fairness, updating to a range-based for loop would give the same effective code as using iterators manually in the loop as they have done. I'm not convinced any new features in C++23 (after C++11) would have given a performance improvement - was there something you had in mind?

The choice of std::list is a bit more dubious. Looking at the code (I found a mirror [1]), it seems like it's mostly for appending and iterating but there is pop_front in one place. Maybe std::deque would be better? Or std::vector with an iterator noting the effective start? Or maybe they were deliberately choosing a poor data structure to stress the compiler (and if so the OP should've used a linked list in Rust for fairness). The article doesn't comment so we can only guess their motivation.

[1] https://github.com/hundt98847/multi-language-bench/blob/mast...

npalli•1d ago
std::list to std::vector should be the big one.

std::map to std::unordered_map could be next.

then, really ranges/constexpr/std::move could make a difference, hard to say definitely.

Beyond these, Modern C++ would have most definitely led to much shorter code as that was a metric for comparison.

quietbritishjim•1d ago
> std::list to std::vector should be the big one

That is not a "C++23 best practice", which is what I was replying to. It doesn't even need C++11! And one use of this type uses pop_front() so std::vector is not obviously a good choice here.

> std::map to std::unordered_map could be next.

Again, I called out C++11 as possibly making a difference - sure this could help but it doesn't need C++23.

> then, really ranges/constexpr/std::move could make a difference, hard to say definitely.

How? Ranges are a nice syntax but what would they speed up here? There doesn't seem to be anything evaluated at compile time so what's the benefit of constexpr? (Even std::move doesn't have an obvious use in the benchmark code but that's C++11 anyway.)

> Beyond these, Modern C++ would have most definitely led to much shorter code as that was a metric for comparison.

I agree that would be interesting, but I'd be surprised if the code was much shorter. I'd guess something like 10%.

pjmlp•1d ago
> was there something you had in mind?

More like on how to write the code in more ergonomic way than the performance by itself, maybe some of that stuff could even be constepxr/eval.

krona•1d ago
By my reading, the C++ FindSet() implementation of the union/find algorithm builds a temporary list! Incredible scenes.
kvemkon•1d ago
> Raspberry Pi OS Bookworm

> g++ (Debian 12.2.0-14) 12.2.0

> cargo 1.87.0 (99624be96 2025-05-06)

Looks like cargo is not from OS repo. So either use both outdated gcc and rust from RaspiOS or install the recent gcc-15 from experimental.

SkiFire13•1d ago
Moreover they also differ in the optimizer being used. A more fair comparison would use Clang for C++ or rustc_codegen_gcc for Rust, possibly with the same versions of LLVM and/or GCC/libgccjit.
Joker_vD•1d ago
The whole blogpost reads surprisingly angry, for some reason. Is it just my impression?

> And Google can go to hell.

Oh, apparently the tone is intended. Why though?..

Deep learning gets the glory, deep fact checking gets ignored

https://rachel.fast.ai/posts/2025-06-04-enzyme-ml-fails/index.html
253•chmaynard•3h ago•37 comments

Precious Plastic Is in Trouble

https://www.preciousplastic.com//news/problems-in-precious-plastic
31•diggan•1h ago•16 comments

A deep dive into self-improving AI and the Darwin-Gödel Machine

https://richardcsuwandi.github.io/blog/2025/dgm/
51•hardmaru•3h ago•5 comments

Show HN: Ephe – A Minimalist Open-Source Markdown Paper for Today

https://github.com/unvalley/ephe
37•unvalley•2h ago•5 comments

Human Brain Cells on Chip for Sale – First biocomputing platform hits the market

https://spectrum.ieee.org/biological-computer-for-sale
32•mdp2021•3h ago•14 comments

Patched (YC S24) Is Hiring SWEs in Singapore

https://www.ycombinator.com/companies/patched/jobs/hgDeMBr-software-engineer
1•rohansood15•9m ago

Destination: Jupiter

https://clarkesworldmagazine.com/liptak_06_25/
64•AndrewLiptak•5h ago•25 comments

Brain aging shows nonlinear transitions, suggesting a midlife "critical window"

https://www.pnas.org/doi/10.1073/pnas.2416433122
43•derbOac•1h ago•7 comments

The Small World of English

https://www.inotherwords.app/linguabase/
115•michaeld123•9h ago•58 comments

Mapping latitude and longitude to country, state, or city

https://austinhenley.com/blog/coord2state.html
19•azhenley•2h ago•9 comments

Show HN: AirAP AirPlay server - AirPlay to an iOS Device

https://github.com/neon443/AirAP
139•neon443•4h ago•19 comments

Show HN: I wrote a Java decompiler in pure C language

https://github.com/neocanable/garlic
149•neocanable•12h ago•72 comments

Show HN: An Alfred workflow to open GCP services and browse resources within

https://github.com/dineshgowda24/alfred-gcp-workflow
36•dineshgowda24•5h ago•8 comments

Show HN: Gradle plugin for faster Java compiles

https://github.com/elide-dev/gradle
15•sgammon•5h ago•10 comments

Polish engineer creates postage stamp-sized 1980s Atari computer

https://arstechnica.com/gadgets/2025/06/polish-engineer-creates-postage-stamp-sized-1980s-atari-computer/
39•dangle1•2h ago•1 comments

(On | No) Syntactic Support for Error Handling

https://go.dev/blog/error-syntax
283•henrikhorluck•8h ago•376 comments

CVE-2024-47081: Netrc credential leak in PSF requests library

https://seclists.org/fulldisclosure/2025/Jun/2
42•jupenur•6h ago•11 comments

Show HN: Localize React apps without rewriting code

https://github.com/lingodotdev/lingo.dev
59•maxpr•7h ago•53 comments

The Shape of the Essay Field

https://paulgraham.com/field.html
52•luisb•15h ago•34 comments

Ask HN: Options for One-Handed Typing

65•Townley•5h ago•69 comments

Show HN: Controlling 3D models with voice and hand gestures

https://github.com/collidingScopes/3d-model-playground
77•getToTheChopin•10h ago•17 comments

Changing Directions

https://jacobian.org/2025/jun/3/changing-directions/
29•speckx•7h ago•6 comments

Quarkdown: A modern Markdown-based typesetting system

https://github.com/iamgio/quarkdown
577•asicsp•17h ago•245 comments

Swift at Apple: Migrating the Password Monitoring Service from Java

https://www.swift.org/blog/swift-at-apple-migrating-the-password-monitoring-service-from-java/
192•fidotron•8h ago•141 comments

New study casts doubt on the likelihood of Milky Way collision with Andromeda

https://www.durham.ac.uk/departments/academic/physics/news/new-study-casts-doubt-on-the-likelihood-of-milky-way-collision-with-andromeda/
4•layer8•2h ago•0 comments

Meta pauses mobile port tracking tech on Android after researchers cry foul

https://www.theregister.com/2025/06/03/meta_pauses_android_tracking_tech/
8•coloneltcb•1h ago•1 comments

Can adults grow new brain cells?

https://www.livescience.com/health/neuroscience/can-adults-grow-new-brain-cells
55•bookofjoe•4h ago•21 comments

Vision Language Models Are Biased

https://vlmsarebiased.github.io/
124•taesiri•12h ago•98 comments

There should be no Computer Art (1971)

https://dam.org/museum/essays_ui/essays/there-should-be-no-computer-art/
75•glimshe•15h ago•116 comments

How much do language models memorize?

https://arxiv.org/abs/2505.24832
18•mhmmmmmm•9h ago•0 comments