In software engineering, there's a persistent gap between theoretical speed and real-world performance. A recent video from LodeHQ highlights several cases where simpler approaches outperform more complex, theoretically faster techniques.
-
Elm Compiler Goes Native: The Elm compiler now produces native binaries, allowing server-side and CLI applications. This shift from a web-focused runtime to native code yields significant performance gains in practice.
-
ESLint Plugin for Redundant Effects: A new ESLint plugin flags unnecessary React effects, cleaning up code and improving runtime speed. Removing redundant hooks reduces rendering overhead.
-
SQLite Insert Speed Boost: Sorting random BLOB keys before insertion dramatically increases SQLite write speed. This counterintuitive trick leverages how B-tree indexes work, reducing page splits.
-
Why Compilers Skip Strassen's Algorithm: Strassen's fast matrix multiplication (O(n^2.807)) is theoretically faster than the naive O(n^3), but real-world compilers often avoid it. The overhead of recursion, memory access patterns, and constant factors make it slower than simpler algorithms for typical matrix sizes.
The takeaway: always measure, and don't assume complex algorithms will be faster in practice.