How do you recognize an expert?
Daniel Lemire
by Daniel Lemire
2d ago
Go back to the roots: experience. An expert is someone who has repeatedly solved the concrete problem you are encountering. If your toilet leaks, an experienced plumber is an expert. An expert has a track record and has had to face the consequences of their work. Failing is part of what makes an expert: any expert should have stories about how things went wrong. I associate the word expert with ‘the problem’ because we know that expertise does not transfer well: a plumber does not necessarily make a good electrician. And within plumbing, there are problems that only some plumbers should solve ..read more
Visit website
How quickly can you break a long string into lines?
Daniel Lemire
by Daniel Lemire
4d ago
Suppose that you receive a long string and you need to break it down into lines. Consider the simplified problems where you need to break the string into segments of (say) 72 characters. It is a relevant problem if your string is a base64 string or a Fortran formatted statement. The problem could be a bit complicated because you might need consider the syntax. So the speed of breaking into a new line every 72 characters irrespective of the content provides an upper bound on the performance of breaking content into lines. The most obvious algorithm could be to copy the content, line by line: v ..read more
Visit website
C++ web app with Crow: early scalability results
Daniel Lemire
by Daniel Lemire
2w ago
Last year, I looked at writing small “hello world” web applications in various programming languages (Go, JavaScript, Nim…). Go, using nothing but the standard library, did well. In these benchmarks, I am just programming an HTTP route that returns a small string (e.g., ‘hello world’). The query is from the host itself. The intent behind such a benchmark is to measure how well an web application might scale in the best of cases. I call such a benchmark ‘simplistic’ because nobody only ever returns just a short string and you do not usually query the server from the host. At the time, I had wan ..read more
Visit website
Science and Technology links (March 31 2024)
Daniel Lemire
by Daniel Lemire
3w ago
Large language models (e.g., ChatGPT) do better at legal questions that lawyers: Our empirical analysis benchmarks LLMs against a ground truth set by Senior Lawyers, uncovering that advanced models match or exceed human accuracy in determining legal issues (Martin et al.). Gene therapy-mediated partial reprogramming extends lifespan and reverses age-related changes in aged mice. Increases vegetation greenness is called greening. Increased atmospheric CO2 is expected to lead to greening since CO2 is effectively a fertilizer. Global greening is a robust process that continued from 2001 to 2020 ..read more
Visit website
Measuring your system’s performance using software (Go edition)
Daniel Lemire
by Daniel Lemire
1M ago
When programming software, we are working over an abstraction over a system. The computer hardware may not know about your functions, your variables, and your data. It may only see bits and instructions. Yet to write efficient software, the programmer needs to be aware of the characteristics of the underlying system. Thankfully, we can also use the software itself to observe the behavior of the system through experiments. Between the software and the hardware, there are several layers such as the compilers, the operating system, and the hardware. A good programmer should take into account thes ..read more
Visit website
How to read files quickly in JavaScript
Daniel Lemire
by Daniel Lemire
1M ago
Suppose you need to read several files on a server using JavaScript. There are many ways to read files in JavaScript with a runtime like Node.js. Which one is best? Let us consider the various approaches. Using fs.promises const fs = require('fs/promises'); const readFile = fs.readFile; readFile("lipsum.txt", { encoding: 'utf-8' }) .then((data) => {...}) .catch((err) => {...}) Using fs.readFile and util.promisify const fs = require('fs'); const util = require('util'); const readFile = util.promisify(fs.readFile); readFile("lipsum.txt", { encoding: 'utf-8' }) .then((data) => ..read more
Visit website
How many political parties rule Canada? Fun with statistics
Daniel Lemire
by Daniel Lemire
1M ago
Canada has several political parties with elected member of parliament: the Liberals, the Conservatives, the Bloc Québecois, de NDP and the Green. But do they behave as distinct political parties when voting, or are they somehow aligned? Voting data for the member of parliament in Canada is easily accessible as JSON or XML. Thus I wrote a little Python script to compute, for each vote, what percentage of each party voted yea. I use the latest 394 votes. It turns out that, overwhelming, the percentage is either 0% or 100%. So individual members of parliament are not relevant, only caucuses matt ..read more
Visit website
Book review: Theft of Fire by Devon Eriksen
Daniel Lemire
by Daniel Lemire
2M ago
When I was young, science fiction was the genre of choice for many engineers and scientists. But the genre declined significantly in recent years. Part of the problem is the rise dystopian fiction. In the imagined future, we are no longer conquering space or developing new fantastic technologies, but rather, increasingly, battling the consequences of climate change or of some evil corporation. In some respect, science fiction is always about the present and present has become unimaginative, fearful and generally anxious. To illustrate, let me quote a recent piece in the Atlantic: The United ..read more
Visit website
Measuring energy usage: regular code vs. SIMD code
Daniel Lemire
by Daniel Lemire
2M ago
Modern processor have fancy instructions that can do many operations at one using wide registers: SIMD instructions. Intel and AMD have 512-bit registers and associated instructions under AVX-512. You expect these instructions to use more power, more energy. However, they get the job done faster. Do you save energy overall? You should expect so. Let us consider an example. I can just sum all values in a large array. float sum(float *data, size_t N) { double counter = 0; for (size_t i = 0; i < N; i++) { counter += data[i]; } return counter; } If I leave it as is, the compiler m ..read more
Visit website
JSON Parsing: Intel Sapphire Rapids versus AMD Zen 4
Daniel Lemire
by Daniel Lemire
2M ago
Intel has release a new generation of server processors (Sapphire Rapids) while the latest AMD technology (Zen 4) is now broadly available. There are extensive comparisons available. Of particular interest is the open benchmark results which assess various aspects of processor speeds, including JSON parsing performance. In these benchmarks, AMD systems appear to dominate. I decided to run my own benchmarks using JSON parsing as a reference and commonly available Amazon big nodes. For these tests, I use Amazon Linux 2023 with GCC 11. I use two instances that cost about 5 dollars per hour. Amazo ..read more
Visit website

Follow Daniel Lemire on FeedSpot

Continue with Google
Continue with Apple
OR