frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos

https://research.kudelskisecurity.com/2025/08/19/how-we-exploited-coderabbit-from-a-simple-pr-to-rce-and-write-access-on-1m-repositories/
369•spiridow•5h ago•121 comments

D2 (text to diagram tool) now supports ASCII renders

https://d2lang.com/blog/ascii/
113•alixanderwang•3h ago•14 comments

Emacs as your video-trimming tool

https://xenodium.com/emacs-as-your-video-trimming-tool
135•xenodium•5h ago•68 comments

Perfect Freehand – Draw perfect pressure-sensitive freehand lines

https://www.perfectfreehand.com/
63•NikxDa•1h ago•4 comments

Without the futex, it's futile

https://h4x0r.org/futex/
203•eatonphil•7h ago•99 comments

Show HN: OpenAI/reflect – Physical AI Assistant that illuminates your life

https://github.com/openai/openai-reflect
20•Sean-Der•1h ago•7 comments

How Figma’s multiplayer technology works (2019)

https://www.figma.com/blog/how-figmas-multiplayer-technology-works/
71•redbell•3d ago•31 comments

The new geography of stolen goods

https://www.economist.com/interactive/britain/2025/08/17/the-new-geography-of-stolen-goods
49•tlb•1d ago•29 comments

Candle Flame Oscillations as a Clock

https://cpldcpu.com/2025/08/13/candle-flame-oscillations-as-a-clock/
203•cpldcpu•3d ago•41 comments

Vendors that treat single sign-on as a luxury feature

https://sso.tax/
143•vinnyglennon•1h ago•75 comments

Notion releases offline mode

https://www.notion.com/help/guides/working-offline-in-notion-everything-you-need-to-know
123•ericzawo•2h ago•86 comments

AnduinOS

https://www.anduinos.com/
45•TheFreim•2h ago•58 comments

Why Semantic Layers Matter (and how to build one with DuckDB)

https://motherduck.com/blog/semantic-layer-duckdb-tutorial/
40•secondrow•4h ago•2 comments

Custom telescope mount using harmonic drives and ESP32

https://www.svendewaerhert.com/blog/telescope-mount/
238•waerhert•11h ago•86 comments

Lazy-brush – smooth drawing with mouse or finger

https://lazybrush.dulnan.net
543•tvdvd•4d ago•67 comments

A renovation project in Turkey led to the discovery of a lost city (2023)

https://www.atlasobscura.com/articles/derinkuyu-turkey-underground-city-strange-maps
52•areoform•5h ago•13 comments

Branch prediction: Why CPUs can't wait?

https://namvdo.ai/cpu-branch-prediction/
13•signa11•3d ago•13 comments

The joy of recursion, immutable data, & pure functions: Making mazes with JS

https://jrsinclair.com/articles/2025/joy-of-immutable-data-recursion-pure-functions-javascript-mazes/
20•jrsinclair•1d ago•1 comments

CRDT: Text Buffer

https://madebyevan.com/algos/crdt-text-buffer/
8•skadamat•1h ago•0 comments

Launch HN: Uplift (YC S25) – Voice models for under-served languages

75•zaidqureshi•9h ago•35 comments

How to Build a Medieval Castle

https://archaeology.org/issues/september-october-2025/features/how-to-build-a-medieval-castle/
208•benbreen•16h ago•62 comments

Show HN: Chroma Cloud – serverless search database for AI

https://trychroma.com/cloud
66•jeffchuber•1d ago•21 comments

Geotoy – Shadertoy for 3D Geometry

https://3d.ameo.design/geotoy
85•Ameo•1d ago•15 comments

CRLite: Certificate Revocation Checking in Firefox

https://hacks.mozilla.org/2025/08/crlite-fast-private-and-comprehensive-certificate-revocation-checking-in-firefox/
34•TangerineDream•5h ago•2 comments

Launch HN: Parachute (YC S25) – Guardrails for Clinical AI

48•ariavikram•6h ago•19 comments

Critical Cache Poisoning Vulnerability in Dnsmasq

https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2025q3/018288.html
106•westurner•8h ago•71 comments

Positron, a New Data Science IDE

https://posit.co/blog/positron-product-announcement-aug-2025/
110•kgwgk•7h ago•36 comments

Prime Number Grid

https://susam.net/primegrid.html
256•todsacerdoti•13h ago•89 comments

Medical cannabis patient data exposed by unsecured database

https://www.wired.com/story/highly-sensitive-medical-cannabis-patient-data-exposed-by-unsecured-database/
33•hacker_yacker•2h ago•10 comments

"Remove mentions of XSLT from the html spec"

https://github.com/whatwg/html/pull/11563
302•troupo•6h ago•369 comments
Open in hackernews

Branch prediction: Why CPUs can't wait?

https://namvdo.ai/cpu-branch-prediction/
13•signa11•3d ago

Comments

whitten•46m ago
I know branch prediction is essential if you have instruction pipelining in actual CPU hardware.

It is an interesting thought experiment re instruction pipelining in a virtual machine or interpreter design. What would you change in a design to allow it ? Would an asynchronous architecture be necessary ? How would you merge control flow together efficiently to take advantage of it ?

addaon•2m ago
> I know branch prediction is essential if you have instruction pipelining in actual CPU hardware.

With sufficiently slow memory, relative to the pipeline speed. A microcontroller executing out of TCM doesn’t gain anything from prediction, since instruction fetches can keep up with the pipeline.

zenolijo•39m ago
I do wonder how branch prediction actually works in the CPU, predicting which branch to take also seems like it should be expensive, but I guess something clever is going on.

I've also found G_LIKELY and G_UNLIKELY in glib to be useful when writing some types of performance-critical code. Would be a fun experiment to compare the assembly when using it and not using it.

hansvm•16m ago
Semantically it's just a table from instruction location to branch probability. Some nuances exist in:

- Table overflow mitigation: multi-leveled tables, not wasting space on 100% predicted branches, etc

- Table eviction: Rolling counts are actually impossible without space consumption; do you have space wasted, periodic flushing, exponential moving averages, etc

- Table initialization: When do you start caring about a branch (and wasting table space), how conservative are the initial parameters, etc

- Table overflow: What do you do when a branch doesn't fit in the table but should

As a rule of thumb, no extra information/context is used for branch prediction. If a program over the course of a few thousand instructions hits a branch X% of the time, then X will be the branch prediction. If you have context you want to use to influence the prediction, you need to manifest that context as additional lines of assembly the predictor can use in its lookup table.

As another rule of thumb, if the hot path has more than a few thousand branches (on modern architectures, often just a few thousand <100% branches (you want the assembly to generate the jump-if-not-equal in the right direction for that architecture though, else you'll get a 100% misprediction rate instead)) then you'll hit slow paths -- multi-leveled search, mispredicted branches, etc.

It's reasonably interesting, and given that it's hardware it's definitely clever, but it's not _that_ clever from a software perspective. Is there anything in particular you're curious about?

NobodyNada•3m ago
> If a program over the course of a few thousand instructions hits a branch X% of the time, then X will be the branch prediction.

This is not completely true - modern branch predictors can recognize patterns such as "this branch is taken every other time", or "every 5th time", etc. They also can, in some cases, recognize correlations between nearby branches.

However, they won't use factors like register or memory contents to predict branches, because that would require waiting for that data to be available to make the prediction -- which of course defeats the point of branch prediction.

dmoy•16m ago
There's a bunch of ways it works. There's a tradeoff between hardware cost and accuracy. Sometimes it's static, sometimes there's a counter of varying size (1 bit, 2 bit, etc). It can get a lot more complicated.

The basic branch predictors are very cheap, and often good enough (90%+ accuracy).

Patterson & Hennessy goes into a bunch of detail.

rayiner•13m ago
It’s fairly expensive but well suited to pipelined implementations in hardware circuits: https://medium.com/@himanshu0525125/global-history-branch-pr.... Modern CPU branch predictors can deliver multiple predictions per clock cycle.
delta_p_delta_x•11m ago
> I do wonder how branch prediction actually works in the CPU, predicting which branch to take also seems like it should be expensive

There are a few hardware algorithms that are vendor-dependent. The earliest branch predictors were two-bit saturating counters that moved between four states of 'strongly taken', 'weakly taken', 'weakly not taken', 'strongly not taken', and the state change depended on the eventual computed result of the branch.

Newer branch predictors are stuff like two-level adaptive branch predictors that are a hardware `std::unordered_map` of branch instruction addresses to the above-mentioned saturating counters; this remembers the result of the last n (where n is the size of the map) branch instructions.

Ryzen CPUs contain perceptron branch predictors that are basically hardware neural networks—not far from LLMs.

bee_rider•8m ago
Modern branch predictors are pretty sophisticated. But, it is also worth keeping in mind that you can do pretty good, for a lot of codes, by predicting simple things like “backwards jumps will probably be followed.” Because a backwards jump is probably a loop, and so jumping backwards is by far the most likely thing to do (because most loops go through more than one iteration).

And a lot of programmers are willing to conspire with the hardware folks, to make sure their heuristics work out. Poor branches, never had any chances.

moregrist•7m ago
There’s ample information out there. There are quite a few text books, blogs, and YouTube videos covering computer architecture, including branch prediction.

For example: - Dan Luu has a nice write-up: https://danluu.com/branch-prediction/ - Wikipedia’s page is decent: https://en.m.wikipedia.org/wiki/Branch_predictor

> I've also found G_LIKELY and G_UNLIKELY in glib to be useful when writing some types of performance-critical code.

A lot of the time this is a hint to the compiler on what the expected paths are so it can keep those paths linear. IIRC, this mainly helps instruction cache locality.

pkaye•6m ago
Here is some examples of the different branch prediction algorithms.

https://enesharman.medium.com/branch-prediction-algorithms-a...

atq2119•2m ago
[delayed]
ip26•1m ago
It is expensive, but it’s even more expensive not to.
Izmaki•5m ago
My favourite explanation of how Branch Prediction works: https://stackoverflow.com/a/11227902/1150676