Should Node.js be built with ClangCL under Windows?
Daniel Lemire
by Daniel Lemire
4d ago
Under Windows, when using Visual Studio to build C++ code, there are two possible compiler strategies. The Visual Studio compiler (often referred to as MSVC) is the default compiler provided by Microsoft for Windows development. In Debug mode, the regular Visual Studio compiler produces faster compilation times and more performant code compared to ClangCL. ClangCL is part of the Clang/LLVM project, which is an open-source compiler toolchain. ClangCL is compatible with the Visual Studio runtime and links with the Microsoft implementation of the Standard Library. It’s available as an optional co ..read more
Visit website
Large language models (e.g., ChatGPT) as research assistants
Daniel Lemire
by Daniel Lemire
1w ago
Software can beat human beings at most games… from Chess to Go, and even poker. Large language models like GPT-4 offered through services such as ChatGPT allow us to solve a new breed of problems. GPT-4 can beat 90% of human beings at the bar exam. Artificial intelligence can match math Olympians. The primary skills of academics are language-related: synthesis, analogy, extrapolation, etc. Academics analyze the literature, identify gaps, and formulate research questions. They review and synthesize existing research. They write research papers, grant proposals, and reports. Being able to produc ..read more
Visit website
How do you recognize an expert?
Daniel Lemire
by Daniel Lemire
2w 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
2w 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
1M 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
1M 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
2M 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

Follow Daniel Lemire on FeedSpot

Continue with Google
Continue with Apple
OR