Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]

orlp.net - Blog Archive

Sort By

Recent [alt+2]
Two-Stack Sliding-Window Aggregation An aggregation is some kind of summary of a set of data. This can be the sum, length, minimum, etc....
5 days ago
1

Two-Stack Sliding-Window Aggregation

from orlp.net - Blog Archive [alt+shift+b] in programming

5 days ago
An aggregation is some kind of summary of a set of data. This can be the sum, length, minimum, etc. It is quite common to want to calculate such a summary repeatedly, e.g. “the maximum noise level in dB for the past 30 seconds” for a nuisance detector. In such a case we say there...
Sorting with Fibonacci Numbers and a Knuth Reward Check The following incredibly small sorting algorithm has an $O(n^{4/3})$ worst-case runtime: def...
31st Dec 2025
1

Sorting with Fibonacci Numbers and a Knuth Reward Check

from orlp.net - Blog Archive [alt+shift+b] in programming

31st Dec 2025
The following incredibly small sorting algorithm has an $O(n^{4/3})$ worst-case runtime: def fibonacci_sort(v): a, b = 1, 1 while a * b < len(v): a, b = b, a + b while a > 0: a, b = b - a, a g = a * b for i in range(g, len(v)): ...
Why Bad AI Is Here to Stay It seems that in 2025 a lot of people fall into one of two camps when it comes to AI: skeptic or...
2nd Feb 2025
85

Why Bad AI Is Here to Stay

from orlp.net - Blog Archive [alt+shift+b] in programming

2nd Feb 2025
It seems that in 2025 a lot of people fall into one of two camps when it comes to AI: skeptic or fanatic. The skeptic thinks AI sucks, that it’s overhyped, it only ever parrots nonsense and it will all blow over soon. The fanatic thinks general human-level intelligence is just...
Breaking CityHash64, MurmurHash2/3, wyhash, and more... Hash functions are incredibly neat mathematical objects. They can map arbitrary data to a small...
2nd Nov 2024
82

Breaking CityHash64, MurmurHash2/3, wyhash, and more...

from orlp.net - Blog Archive [alt+shift+b] in programming

2nd Nov 2024
Hash functions are incredibly neat mathematical objects. They can map arbitrary data to a small fixed-size output domain such that the mapping is deterministic, yet appears to be random. This “deterministic randomness” is incredibly useful for a variety of purposes, such as hash...
Taming Floating-Point Sums Suppose you have an array of floating-point numbers, and wish to sum them. You might naively think...
25th May 2024
66

Taming Floating-Point Sums

from orlp.net - Blog Archive [alt+shift+b] in programming

25th May 2024
Suppose you have an array of floating-point numbers, and wish to sum them. You might naively think you can simply add them, e.g. in Rust: fn naive_sum(arr: &[f32]) -> f32 { let mut out = 0.0; for x in arr { out += *x; } out } This however can easily...
When Random Isn't This post is an anecdote from over a decade ago, of which I lost the actual code. So please forgive...
10th Jan 2024
48

When Random Isn't

from orlp.net - Blog Archive [alt+shift+b] in programming

10th Jan 2024
This post is an anecdote from over a decade ago, of which I lost the actual code. So please forgive me if I do not accurately remember all the details. Some details are also simplified so that anyone that likes computer security can enjoy this article, not just those who have...
Branchless Lomuto Partitioning A partition function accepts as input an array of elements, and a function returning a bool (a...
4th Dec 2023
35

Branchless Lomuto Partitioning

from orlp.net - Blog Archive [alt+shift+b] in programming

4th Dec 2023
A partition function accepts as input an array of elements, and a function returning a bool (a predicate) which indicates if an element should be in the first, or second partition. Then it returns two arrays, the two partitions: def partition(v, pred): first = [x for x in v...
Subtraction Is Functionally Complete To be precise, IEEE-754 floating point subtraction is functionally complete. That means you can...
28th Sep 2023
31

Subtraction Is Functionally Complete

from orlp.net - Blog Archive [alt+shift+b] in programming

28th Sep 2023
To be precise, IEEE-754 floating point subtraction is functionally complete. That means you can construct any binary circuit using nothing but floating point subtraction. To see how, we must start at the bottom. I quote the IEEE 754-2019 standard, section 6.3: 6.3 The sign...
Bitwise Binary Search: Elegant and Fast I recently read the article Beautiful Branchless Binary Search by Malte Skarupke. In it they discuss...
16th May 2023
34

Bitwise Binary Search: Elegant and Fast

from orlp.net - Blog Archive [alt+shift+b] in programming

16th May 2023
I recently read the article Beautiful Branchless Binary Search by Malte Skarupke. In it they discuss the merits of the following snippet of C++ code implementing a binary search: template<typename It, typename T, typename Cmp> It lower_bound_skarupke(It begin, It end, const T&...
The World's Smallest Hash Table This December I once again did the Advent of Code, in Rust. If you are interested, my solutions are...
4th Mar 2023
32

The World's Smallest Hash Table

from orlp.net - Blog Archive [alt+shift+b] in programming

4th Mar 2023
This December I once again did the Advent of Code, in Rust. If you are interested, my solutions are on Github. I wanted to highlight one particular solution to the day 2 problem as it is both optimized completely beyond the point of reason yet contains a useful technique. For...
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in