Our fast_float library parses numbers such as -731.51 into binary floating-point values. It is part of GCC's C++ standard library, among others. It is fast: often a few nanoseconds per number. Parsing a number means making decisions. Is there a sign? How many digits are there? Where is the decimal point? Is the processor rounding in the default mode? Each decision is a branch in the code. Modern processors do not wait to know the outcome of a branch: they guess, and they keep working.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Daniel Lemire
A performance trap: when store forwarding fails
A store does not go straight into the cache. Waiting for that write would stall the processor. It sits in a store buffer, and a later load can take its bytes from that buffer. That is store forwarding. Forwarding works when the load is the same size as the store, or smaller and completely inside it. It fails when the load is wider than the store, or when the two ranges only partly overlap. The load then waits until the store has reached the cache. Here is an example in C.
Open source as a research method
Many people still picture innovation as a line. The professor thinks and publishes. The engineer reads the paper and designs a product. The customer consumes it. It rarely works that way. The industrial revolution was not set off by professors writing papers. It was driven by demand for cheap and better clothing for the masses. Demand came first. Michael Stonebraker made a related point in "Where We Have Failed" (2018).
In C++, = default and {} are not the same constructor
You can write an empty default constructor as span() = default or as span() {}. It can have remarkable effects on performance. The constructor span() = default on its first declaration makes span trivial. The constructor span() {} is user-provided, so span is not trivial. An example This span is a start pointer, a length, and an end pointer. A box holds one span. The expression box() value-initializes that span.
Beating the compiler at signed 32-bit division
Dividing integers is slow on our processors. A 32-bit division costs: On Zen 4 and Zen 5, the latency depends on the inputs. The x86 rows are idiv ( uops.info). The Apple row is sdiv ( measurements). A multiplication has a latency of 3 cycles. Emerald Rapids can do one every cycle. Zen 5 and Arrow Lake do three 64-bit multiplications per cycle ( uops.info). Thankfully, when the divisor is a constant, compilers replace the division by a multiplication and a shift (Granlund and Montgomery, 1994).
Billion-query-per-second lookup tables in C++
A lot of software spends its time mapping strings to values. A web server must identify the HTTP method ( GET, POST, ...). It must recognize header names. A URL parser must recognize the protocol ( http, https, ftp, ...). A compiler must recognize keywords. In C++, the default approach is to put the strings in a std::unordered_map. It works. But notice something: the keys are known when you write the code. They never change.
Billion-query-per-second lookup tables in C++
Technology 9 hours ago 20 AWS Cost Optimization Moves That Still Pay Off hackernoon.com - Fedir Kompaniiets • 9h Most AWS bills I audit are not bloated because of exotic architecture mistakes.
Decoding base64 in Python at 10 gigabytes per second
We sometimes need to convert binary data to text. For example, your emails must be stored as text files. Naïvely, you could just use a string of 0 and 1, but it would mean using one character per bit. We can do better by using 64 ASCII characters: all letters, all numbers, plus a few extra characters. Base64 represents three bytes with four ASCII characters.
Redis now has compressed bitmaps (Roaring)
Redis is an in-memory database. Salvatore Sanfilippo started it in 2009, and it is now one of the most widely deployed pieces of server software. It is often used as a cache in front of a slower database. You talk to it over the network with short text commands such as SET user:42 "Alice" and GET user:42. Each key maps to a value, and the value can be more than a string: Redis has lists, hashes, sets, sorted sets, streams and more, each with its own commands.
Parsing JSON at tens of gigabytes per second... in Python
Python used to have limited parallelism, due to its global interpreter lock (GIL). Only one thread could run Python code at a time. Python 3.14 comes in a free-threaded version ( python3.14t), without the global interpreter lock. Several threads can now run Python code at the same time. Let us pick a realistic problem. GitHub publishes everything that happens on its public repositories: pushes, issues, pull requests, stars, and so forth.
WebSocket servers in JavaScript: Node.js, Bun and Deno in 2026
WebSocket is a standard protocol to hook up a client and a server in a persistent manner. It is commonly used for live chat, notifications, multiplayer games, collaborative editing, and streaming dashboards. Many servers are written in JavaScript and use Node.js, Bun or Deno as an engine. A few years ago, I wrote a simple WebSocket benchmark in JavaScript.
Faster Python startup with lazy imports
When a Python program starts, it needs to load all its dependencies ( import). With the upcoming version of Python, it is possible to use lazy imports instead. In this instance, the name json is no longer the module, but a mere placeholder object. The actual import only happens when you use json. If you never use json, the module is never loaded. How much does it help? Let us measure. I wrote a toy command-line tool.
Mastering SIMD with Java Vector API
I write a lot about data parallelism. About how our processors have special instructions that can do several operations at once. They are often critical to get the best performance out of a CPU. Compilers are sometimes able to take advantage of these instructions. But it is hard to tell when it will work. For Java programmers, you can write directly for data parallelism since JDK 16. With enough skill, you might multiply the performance of a few key functions.
Faster software linking with mold
When you build a program, the compiler turns each source file into an object file. Then a linker stitches all the object files and libraries into one executable. On Linux, the default linker is usually GNU ld (also called bfd). The GNU binutils also ship gold, an alternative linker that was designed to be faster. Gold was built a Google and first made available in 2008. The mold linker is a newer linker written by Rui Ueyama, it was first released in 2021.
Ephemeral testing
We have many ways to ensure software quality. Unit testing. Fuzz testing. Integration testing. And so forth. I'd like to propose a method that was unthinkable before: ephemeral testing . (Ephemeral is a fancy word for 'throw away' or 'temporary'.) You write your code. You build your software component. Or the AI agent does it for you, it does not matter. Then you ask an AI agent to build on it: an application, another layer, maybe several. You have it test what it built.
Google's first orbital data center is in orbit
Google's first orbital data center is in orbit (October 1st). They say it is about the size of a fridge. It has one kilowatt of solar power. It is about the power of a household. It was launched on a Falcon 9 rocket (SpaceX). It should run for about a year. Google plans to launch two more orbital data centres next year. The plan is to use laser communications. For people complaining that the latency is going to be a problem with orbital data centres...
Research paper overload: submissions capped at two a month
Much of my research is on arXiv. I was one of the early adopters. It is simply a repository of research papers with PDF and metadata. It makes it convenient to find research without any paywall. Physicists started it in 1991. Math and computer science followed gradually. It relies on volunteers to moderate it, because we don't want garbage or spam. On October 1, they capped the submissions to two per person per month. Why? arXiv got over 40,000 submissions in September. Two years ago, it was about 20,000.
Parsing compressed JSON at 40 GB/s
A common way to store JSON data is to write one document per line. We call it NDJSON or JSON Lines. Log files, database exports and machine-learning datasets often come in this format. The files can be large, so we may compress them. How fast can you read such a file? I wrote a small demo with simdjson. My test file has 5 million records: 812 MB of NDJSON. For each record, I read a few fields. I count the active records, and I sum the scores of the active records whose user has the admin tag.
Transcoding UTF-8 to UTF-16 with replacement at gigabytes per second
Our software represents strings using the UTF-16 or the UTF-8 formats. Most text on the web is UTF-8, but Java, C# or JavaScript represents the strings as UTF-16 to the programmer. Sometimes we need to transcode (convert) strings. Your browser probably uses the simdutf library for validating or transcoding. It is part of the widely used V8 JavaScript engine.
How do you deal with people who strongly disagree with your views?
1. Begin by genuinely listening to them. Make sure that you understand them. It is often useful to ask for confirmation: restate what you think they are saying and make sure that you understand. Physically, it helps to turn your shoulders so that you face them. Don't look at your screen while they talk.
simdjson 5.0 is out
The simdjson library is a C++ library to parse and generate JSON. It is used in Node.js, ClickHouse, Meta Velox, StarRocks, Apache Doris, the Ladybird browser and many other systems. We released version 4.0 a year ago, in September 2025. Its headline feature was C++26 static reflection: you could turn a C++ structure into JSON, and back, without writing any glue code. Today we are releasing version 5.0. Static reflection is no longer guarded and is an officially supported feature.
How fast can you fix a UTF-16 string in C#?
C# strings are UTF-16. Most characters are one 16-bit code unit. Characters outside the basic multilingual plane, emoji included, take two: a high surrogate (U+D800 to U+DBFF) followed by a low surrogate (U+DC00 to U+DFFF). A surrogate with the wrong neighbor, or with none, is ill-formed. You should never send an ill-formed string to disk or to the network. It is a bad practice.
A thesis isn't enough for a PhD
To get a PhD, you typically have to enroll in a graduate program. Then you complete a few relatively easy courses. You might need to pass a comprehensive examination that checks whether you have a basic understanding of the field. A few students fail at this point, but not many.Then you write a thesis ...
How many strings can you create per second?
We create new strings all the time. How quickly can you produce short strings in your programming languge? To create a meaningful string, we convert an integer to a string. In Python, that is str(i). The loop stores each new string in a small ring buffer of 1024 slots, so that the engine cannot simply discard the work.
If you don't have the factories, you lose the expertise
Mainstream economists have been advocating for the marvellous effects of global trade for decades. Who needs these factory jobs anyway? We'll be designing the robots and the nuclear rockets. Except that, no. It does not work like that. If you have the factories, sooner or later, you get the designers. If you don't have the factories, you lose the expertise. Or you never get it. There aren't that many people left in the Silicon Valley capable of working on silicon. You can design a chip from California.
A summer of AI optimization
I maintain and comaintain several open-source libraries. Some of them are widely used: ada parses URLs in Node.js, fast_float parses numbers in GCC's standard library and in Chromium, simdjson parses JSON in Node.js, simdutf validates and transcodes Unicode in Node.js, and the Roaring bitmap libraries sit inside many database engines. These libraries are mature. They have been optimized for years, by me and by others. For a long time, their performance was flat.
The data does not show mass unemployment
If AI is causing mass unemployment among software developers, it is not showing up in the data yet. The USA had more software developers as a percentage of the population in 2025 than in 2021. On average salaries are slightly up (average of 148k$ a year). The 90th percentile is up from 2021 ...
AI is breaking the academic sorting machine
Let us be clear on what we are talking about. In a few weeks, someone who is not a high-level mathematician can, with AI, produce the equivalent of a good PhD thesis in math. I could see a top 1% high school student, given enough of an AI token budget, just write the equivalent of a PhD thesis as a hobby. If Joe Smith completed a PhD thesis in math back in 2022, it is now possible for a really smart high schooler to generate the same output while playing video games.
How did Apple Silicon get 50% faster in three years?
Recently, I looked at how AMD made its chips 50% faster within a span of two years, in How did AMD Ryzen get 50% faster in two years? Many people asked me to cover Apple processors. So let us go. Consider the base Apple Silicon chips: M2 (2022), M3 (2023), M4 (2024) and M5 (2025). I am skipping the original one (M1) for simplicity and I am not considering the Pro and Max chips. The M6 is out there too, just released, but I am going to cover it at the end.
Faster JSON parsing with SVE2 on ARM processors
ARM processors, like those in your phone, have instructions capable of processing several elements at once (SIMD). These instructions are called NEON. But many newer processors have a different SIMD extension called SVE. The latest ARM processors have SVE2. Unfortunately, Apple has not yet adopted SVE, but SVE processors are available in the cloud. In April, I wrote that the SVE2 match instruction might be the fastest way to match characters on ARM processors. At the time, my benchmark was a toy.
How did AMD Ryzen get 50% faster in two years?
People still tell me that CPUs are boring. That nothing much happens anymore. Let us look at AMD Ryzen 7 processors from 2022 to 2024: the 5800X3D (Zen 3), the 7800X3D (Zen 4) and the 9800X3D (Zen 5). They are comparable 8-core chips with 3D V-Cache. I have written about them before, in How stagnant is CPU technology? On Geekbench 6, performance went up by about 50% in two years. The 2024 chip is 47% faster on a single core than the 2022 chip, and 58% faster with all cores. The clock did not do that.
How fast is C++23's std::flat_map?
C++23 added a new type to the standard library: std::flat_map. There is also a std::flat_set and other variants, but let me focus on std::flat_map. A flat map is a sorted vector of keys next to a vector of values. A query is a binary search over the sorted keys. You need a recent standard library: GCC 15's libstdc++ has std::flat_map, as does LLVM's libc++ since LLVM 20 (Apple's clang 17 has it too). Because the container is just two arrays, we can save it by copying the two arrays.
Subnormal floating-point numbers are expensive... on Intel processors
We represent floating-point numbers using the IEEE standard. For very small numbers, the standard uses special subnormal numbers. Unfortunately, they have a reputation of making operations slow. Thus video game programmers and machine learning specialists sometimes avoid computing with subnormal numbers for performance. How slow are they? Let me measure.
The four-colour theorem was only the start
Mathematicians are unhappy about OpenAI. Several influential mathematicians wrote an open letter. The gist of their argument is that they form a community that trains young people. When AI started producing breakthroughs on hard mathematical problems, I asked what a very smart 17-year-old would feel. Do you still choose a math major and train yourself to prove difficult results by hand? This crisis has been coming for a long time.
Fear Is Not an Argument
We are told that AI entities much like ChatGPT might soon kill us all. The statement is vague and unfalsifiable. It might be true, it might be false. People with credential (e.g., Turing Award recipient Yoshua Bengio) believe it. Many still remember the Year-2000 bug. Our computers used two-digit coding for dates, and some software could get confused. At the time, experts worried that a bug in dates might trigger nuclear Armageddon or an infrastructure collapse. At the very least, planes could fall.
A quick overview of atomics in C
If you write in C, by default, you use a single thread. Extra cores do not help until you create more threads. However, if you include the header <threads.h>, you can pass a function to thrd_create, and wait for it with thrd_join. Be warned that C11 threads are an optional feature. If the macro __STDC_NO_THREADS__ is defined, you do not have them. Apple's C library has never shipped <threads.h>, so the program above does not compile on macOS, and glibc only added it in version 2.28 (2018).
AI programming: a layered model
In the late 1960s and 1970s, people like David Parnas faced a problem. A decade earlier there were almost no programmers. Suddenly there were hordes of inexperienced ones. What could have been a golden era was turning into a mess: far more software, much of it falling apart.
Python sets and dictionaries can have quadratic-time performance
In Python, the dict data structure is the conventional key-value structure. E.g., you might store a list of names as keys and have their phone numbers as values. Valentin Ignatev wrote this amusing post on X: It is indeed widely believed that, in the strict sense, the dict data structure and its companion, the set data structure, are O(1), meaning that as you increase the size of the data structure, the time to insert or query a key remains constant. Let us examine the claim.
The new Go JSON API: twice as fast, or 1.5x slower?
JSON is a standard format for data interchange. It is effectively a tiny subset of JavaScript made of objects and arrays. It looks as follows {"key":1, "text":[1.0,2.0]}. Many programming languages include a JSON library in their standard libraries: C#, Go, Java (soon), Python, JavaScript, etc. The Go implementation is convenient, but not especially fast. Go 1.27 makes a new JSON package ( encoding/json/v2) available by default in its standard library.
Fixing Ill-Formed UTF-16 Strings With SIMD Instructions
1 Introduction Unicode is the standard for text representation in modern software, supporting over one million characters across diverse writing systems. Unicode assigns each character a unique code point from U + 0000 to U + 10FFFF, organized into 17 planes. The Basic Multilingual Plane (BMP, U + 0000–U + FFFF) contains the most commonly used characters, while supplementary planes encode less frequent characters, such as ideographs or emojis.
Java's String.indexOf can be slow (quadratic)
In Java, you find the location of a substring using indexOf. Naively, you might implement indexOf by a loop inside a loop, like so. The Java implementation is much more sophisticated, and it is highly accelerated. However, there are pathological cases where the Java implementation can be slow. What do I mean? Well, you do expect that the search will be more and more expensive as the size of the string grows. Right?
Parsing IP addresses in C# at crazy speeds
We are all familiar with IP addresses such as 192.168.0.1. They are typically written as four numbers in the range 0 to 255 inclusive, separated by dots. In C#, you can parse them with the standard library using IPAddress.TryParse. Pedantic people are quick to point out that IP addresses can take different forms: they can be IPv6 or IPv4 and there are many weird ways to write an IPv4 address. But for the purpose of performance optimization, we care about the common case.
Go 1.27 will make some allocations cheaper
Like most programming languages, Go has both stack allocations, whose lifetime is limited to the current function, and dynamic (or heap) allocations. The name stack comes from the fact that the memory management is somewhat trivial. There is typically one stack per thread (or goroutine in Go). When a function needs memory, it simply appends data to the stack. When the function returns, the memory is dropped from the end of the stack. So the memory last allocated is deallocated first.
AI programming : are you angry yet?
AI-assisted programming is fast evolving and there is a tension between 'we no longer need to understand the code' and 'what is my purpose as a programmer'. I recorded a short video on this topic with how I think the tension can result in conflicts. Published by
Profile-guided optimization in Go
When a compiler optimizes your program, it has to guess. Which functions are worth inlining? Which side of a branch is the common one? Which method does this interface call actually reach? At compile time it cannot know, so it uses heuristics. Profile-guided optimization (PGO) replaces the guessing with measurement: you run your program, record where it spends its time, and hand that recording back to the compiler for a second build. PGO is a common feature of compiler systems.
How fast is C++26's std::hive?
C++26 adds a new container to the standard library: std::hive. It is meant to occupy the ground between std::vector and std::list. Like a vector, it keeps its elements in contiguous blocks of memory, so scanning it does not require you to chase a pointer for every element. Like a list, it never moves an element once it has been inserted: your pointers, references and iterators stay valid, and you may erase any element in constant time without disturbing the others.
Memory-level parallelism: AMD is the king
When your program asks for memory that is not in cache, the processor has to go to RAM. That trip costs on the order of 100 nanoseconds. On a 3 GHz core, that is about 300 cycles of doing nothing. Memory latency has not improved in ten years. The 2016 Broadwell answers a random access in 100 ns. The 2025 Turin, with DDR5-6400 and every advantage of a decade of progress, takes 140 ns. It got worse. The good news is that a modern core does not have to sit still.
Does a PhD Pay Off?
Every week, I discuss with people who want to get a PhD. For years, I have been advising people not to pursue a PhD. It may come as a surprise to some. You would expect people with a PhD to earn more money. Individuals who complete doctorates tend to have higher cognitive abilities and greater motivation. But smarter people tend to earn more, period. So do people with a PhD earn more?
From Institutions to Individuals: the White House Report on Revitalizing U.S. Scientific Leadership
"`In 1945, Vannevar Bush published a report entitled Science: The Endless Frontier. His thesis was that prosperity follows from basic research. The report was highly influential in the United States and elsewhere. It led to the creation of an entirely new government bureaucracy. With this report, Bush popularized the linear model of innovation: innovation (such as medical cures) flows sequentially from basic research to applied research to development to production and diffusion.
X just gave us an interface that AI agents can use. I pointed it at my own posts.
I have been on X for a long time. Like most people who post regularly, I have a gut feeling for what might interest people. I post in the morning. Longer posts seem to do better. But gut feelings are not measurements. And until recently, digging into your own posting data meant either clicking around the web UI or writing custom scripts. Neither is particularly friendly when you want to ask ad hoc questions with an AI assistant.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Daniel
Contact Daniel, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack