ELSEIF
Your brief EB
264 stories from 71 feeds 51 clusters Refreshed 13 minutes ago next pull 16:35

PERFORMANCE Signal 492

"Clean" Code, Horrible Performance (2023)

A classic “clean-code” shape hierarchy using virtual methods and pointer arrays runs significantly slower than more data-oriented alternatives.

WHY IT MATTERS

Engineers building performance-critical loops will see higher CPU latency from virtual dispatch and pointer indirection. The example shows that adhering strictly to readability-focused rules can outweigh their maintenance benefits in hot code paths.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

Polymorphic virtual calls prevent inlining and add indirect branches, hurting instruction-pipeline efficiency.

02

Storing objects as pointers forces non-contiguous memory access, reducing cache locality compared with flat data layouts.

03

The measured slowdown is confined to tight, high-iteration loops; occasional or non-critical code may still favor the clean-code style.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
Hacker News "Clean" Code, Horrible Performance (2023) Open ↗