frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

We Abandoned Matrix: The Dark Truth About User Security and Safety (2024)

https://forum.hackliberty.org/t/why-we-abandoned-matrix-the-dark-truth-about-user-security-and-sa...
53•Flere-Imsaho•1h ago•31 comments

When Compilers Surprise You

https://xania.org/202512/24-cunning-clang
78•brewmarche•3h ago•29 comments

Super Mario Bros. and Yoshi Games (Yields) Reduced Burnout Risk

https://games.jmir.org/2025/1/e84219/
55•azalemeth•3h ago•42 comments

Your Inbox Is a Bandit

https://parentheticallyspeaking.org/articles/bandit-inbox/
47•zdw•2d ago•28 comments

Fabrice Bellard Releases MicroQuickJS

https://github.com/bellard/mquickjs/blob/main/README.md
1270•Aissen•23h ago•470 comments

The Port I couldn't Ship

https://ammil.industries/the-port-i-couldnt-ship/
61•cjlm•5d ago•17 comments

Some Epstein file redactions are being undone with hacks

https://www.theguardian.com/us-news/2025/dec/23/epstein-unredacted-files-social-media
752•vinni2•20h ago•583 comments

X-ray: a Python library for finding bad redactions in PDF documents

https://github.com/freelawproject/x-ray
572•rendx•18h ago•101 comments

AMD entered the CPU market with reverse-engineered Intel 8080 clone 50 years ago

https://www.tomshardware.com/pc-components/cpus/amd-first-entered-the-cpu-market-with-reverse-eng...
52•ksec•2h ago•17 comments

The e-scooter isn't new – London was zooming around on Autopeds a century ago

https://www.ianvisits.co.uk/articles/the-e-scooter-isnt-new-london-was-zooming-around-on-autopeds...
65•zeristor•8h ago•40 comments

Making a game on a custom bytecode VM in 7 days and 3kB

https://laurent.le-brun.eu/blog/making-a-game-on-a-custom-bytecode-vm-in-7-days-and-3kb
19•laurentlb•5d ago•2 comments

Unifi Travel Router

https://blog.ui.com/article/travel-in-style-unifi-style-unifi-travel-router
376•flurdy•16h ago•328 comments

Nabokov's guide to foreigners learning Russian

https://twitter.com/haravayin_hogh/status/2003299405907247502
170•flaxxen•15h ago•291 comments

Permission Systems for Enterprise That Scale

https://eliocapella.com/blog/permission-systems-for-enterprise/
46•eliocs•6h ago•17 comments

Map: Operator[] Should Be Nodiscard

https://quuxplusone.github.io/blog/2025/12/18/nodiscard-operator-bracket/
48•jandeboevrie•5d ago•33 comments

Mt. Gox CEO Karpelès Reveals Details of 2014 Collapse and Japanese Detention

https://bitcoinmagazine.com/business/former-mt-gox-ceo-mark-karpeles-reveals-details-of-2014-coll...
8•giuliomagnifico•25m ago•0 comments

New reactor produces clean energy and carbon nanotubes from natural gas

https://phys.org/news/2025-12-reactor-energy-carbon-nanotubes-natural.html
30•westurner•2h ago•20 comments

Scaling Go Testing with Contract and Scenario Mocks

https://funnelstory.ai/blog/engineering/scaling-go-testing-with-contract-and-scenario-mocks
25•preetamjinka•5d ago•11 comments

Show HN: LazyPromise = Observable – Signals

https://github.com/lazy-promise/lazy-promise
3•ivan7237d•5d ago•0 comments

I rebuilt FlashAttention in Triton to understand the performance archaeology

https://aminediro.com/posts/flash_attn/
67•amindiro•3d ago•8 comments

Lua 5.5

https://lua.org/versions.html#5.5
365•km•2d ago•114 comments

Show HN: Turn raw HTML into production-ready images for free

https://html2png.dev
120•alvinunreal•14h ago•59 comments

Texas app store age verification law blocked by federal judge

https://www.macrumors.com/2025/12/23/texas-app-store-law-blocked/
273•danso•18h ago•203 comments

Google 2025 recap: Research breakthroughs of the year

https://blog.google/technology/ai/2025-research-breakthroughs/
139•Anon84•7h ago•98 comments

Show HN: Tonbo – an embedded database for serverless and edge runtimes

https://github.com/tonbo-io/tonbo
46•ethegwo•6d ago•11 comments

Perfect Software – Software for an Audience of One

https://outofdesk.netlify.app/blog/perfect-software
176•ggauravr•4d ago•75 comments

Don't Become the Machine

https://armeet.bearblog.dev/becoming-the-machine/
163•armeet•13h ago•98 comments

Proving Bounds for the Randomized MaxCut Approximation Algorithm in Lean4

https://abhamra.com/blog/randomized-maxcut/
51•todsacerdoti•4d ago•1 comments

Open source USB to GPIB converter (for Test and Measurement instruments)

https://github.com/xyphro/UsbGpib
64•v15w•15h ago•28 comments

HTTP Caching, a Refresher

https://danburzo.ro/http-caching-refresher/
145•danburzo•21h ago•23 comments
Open in hackernews

When Compilers Surprise You

https://xania.org/202512/24-cunning-clang
77•brewmarche•3h ago

Comments

mgaunard•2h ago
Those are just basic and essential optimizations, nothing too surprising here.

The sum of integers is actually a question I ask developers in interviews (works well from juniors to seniors), with the extra problem of what happens if we were to use floating-point instead of integers.

bayesnet•1h ago
To provide the solution to the second part of the question, there is no closed-form solution. Since floating point math is not associative, there’s no O(1) optimization that can be applied that preserves the exact output of the O(n) loop.
zipy124•1h ago
Technically there is a closed form solution as long as the answer is less than 2^24 for a float32 or 2^53 for a float64, since below those all integers can be represented fully by a floating point number, and integer addition even with floating point numbers is identical if the result is below those caps. I doubt a compiler would catch that one, but it technically could do the optimisation and have the exact same bit answer. If result was intialised to a non-integer number this would not be true however of course.
bayesnet•1h ago
A very good point! I didn’t think of that.
dist-epoch•38m ago
This is why you have options like -ffast-math, to allow more aggressive but not 100% identical outcome optimizations.
ramraj07•1h ago
Im curious what exactly you ask here. I consider myself to be a decent engineer (for practical purposes) but without a CS degree, and I might likely have not passed that question.

I know compilers can do some crazy optimizations but wouldn't have guessed it'll transform something from O(n) to O(1). Having said that, I dont still feel this has too much relevance to my actual job for the most part. Such performance knowledge seems to be very abstracted away from actual programming by database systems, or managed offerings like spark and snowflake, that unless you intend to work on these systems this knowledge isn't that useful (being aware they happen can be though, for sure).

scuff3d•1h ago
He thinks it makes him look clever, or more likely subtlety wants people to think "wow, this guy thinks something is obvious when Matt Godbolt found it surprising".

This kind of question is entirely useless in an interview. It's just a random bit of trivia that either a potential hire happen to have come across, or happens to remember from math class.

yeasku•42m ago
Trying to look smart by dissing Matt is not a good idea.
nickysielicki•7m ago
Whether they get the question exactly right and can pinpoint the specific compiler passes or algebraic properties responsible for reductions like this is totally irrelevant and not what you’re actually looking for or asking about. It’s a very good jumping point for a conversation about optimization and testing whether they’re the type of developer who has ever looked at the assembly produced in their hotpath or not.

Anyone who dumbly suggests that loops in source code will always result in loops in assembly doesn’t have a clue. Anyone who throws their hands up and says, “I have no idea, but I wonder if there’s some loop invariant or algebraic trick that can be used to optimize this, let’s think about it out loud for a bit” has taken a compiler class and gets full marks. Anyone who says, “I dunno, let’s see what godbolt does and look through the llvm-opt pane” gets an explicit, “hire this one” in the feedback to the hiring manager.

It’s less about what they know and more about if they can find out.

zipy124•1h ago
To those who don't know about compiler optimisation, the replacement with a closed form is rather suprising I'd say, especially if someone with Matt Godbolt's experience of all people is saying it is surprising.

Also this series is targeted towards more of a beginner audience to compilers, thus its likely to be suprising to the audience, even if not to you.

yeasku•1h ago
For Matt, the creator of compiler explorer, those are surprises.

For you are essentials.

You and the juniors you hire must have a deeper knoledge than him.

porise•1h ago
You don't have to be an expert in compiler design to make godbolt in fairness, although he does know a lot.

I spend a lot of time looking at generated assembly and there are some more impressive ones.

yeasku•1h ago
As i said you must have a deeper knoledge than him.

It would be great if you shared it with the world like Matt does instead of being smug about it.

xandrius•1h ago
Nothing is surprising once you know the answer. It takes some mental gymnastics to put yourself in someone else's shoes before they discovered it and thus making it less "basic".
hypeatei•1h ago
What type of positions are you interviewing for? Software development is a big tent and I don't think this would be pertinent in a web dev interview, for example.
cratermoon•56m ago
https://xkcd.com/1053/
phh•13m ago
Since GCC is lacking such an essential optimization, you should consider have one of your junior interviewee contribute this basic optimization mainline.
f1shy•10m ago
I’m pretty sure making an algorithm that converts loops to close forms (I’m sure it detects much more than just a summation) is a little bit complicated.

Maybe you have much more experience than Mr Godbolt in compiliers.

dejj•1h ago
It’s neat. I wonder if someone attempted detecting a graph coloring problem to replace it with a constant.
emih•41m ago
Graph coloring is NP-hard so it would be very difficult to replace it with an O(1) algorithm.

If you mean graph coloring restricted to planar graphs, yes it can always be done with at most 4 colors. But it could still be less, so the answer is not always the same.

(I know it was probably not a very serious comment but I just wanted to infodump about graph theory.)

andrepd•1h ago
I'm actually surprised that gcc doesn't do this! If there's one thing compilers do well is pattern match on code patterns and replace with more efficient ones; just try pasting things from Hacker's Delight and watch it always canonicalise it to the equivalent, fastest machine code.
nikic•1h ago
This particular case isn't really due to pattern matching -- it's a result of a generic optimization that evaluates the exit value of an add recurrence using binomial coefficients (even if the recurrence is non-affine). This means it will work even if the contents of the loop get more exotic (e.g. if you perform the sum over x * x * x * x * x instead of x).
g0wda•1h ago
If you now have a function where you call this one with an integer literal, you will end up with a fully inlined integer answer!
JonChesterfield•57m ago
That one is called scalar evolution, llvm abbreviates it as SCEV. The implementation is relatively complicated.
gslin•56m ago
More similar optimizations: https://matklad.github.io/2025/12/09/do-not-optimize-away.ht...
phplovesong•45m ago
This exact content was posted a few months ago. Is this AI or just a copy paste job?
dist-epoch•41m ago
> I love that despite working with compilers for more than twenty years, they can still surprise and delight me.

This kind of optimization, complete loop removal and computing the final value for simple math loops, is at least 10 years old.

bumholes•9m ago
The code that does this is here, if anyone is curious:

https://github.com/llvm/llvm-project/blob/release/21.x/llvm/...

vatsachak•3m ago
Compilers can add way more closed forms. Would it be worth it?

https://en.wikipedia.org/wiki/Wilf%E2%80%93Zeilberger_pair