Daniel Lemire's blog

Science and Technology links (March 7th 2020)

, 1 min read

The benefits of flu vaccines in healthy adults is modest. They do not reduce neonatal death, hospitalisations, or working day lost. It does not seem more helpful in older adults. While in 1970, only 1% of the American population was severely obese, the percentage of obesity is now at 9%. Older…

Will calling “free” or “delete” in C/C++ release the memory to the system?

, 2 min read

In the C programming language, we typically manage memory manually. A typical heap allocation is a call to malloc followed by a call to free. In C++, you have more options, but it is the same routines under the hood. // allocate N kB data = malloc(N*1024); // do something with the memory // ... //…

Science and Technology links (February 29th 2020)

, 1 min read

No one really understands how planes fly. This puts a dent in the model whereas inventions follows theory. Physician salaries and diagnostic tests account for 4% of GDP in the US. A supplement (NMN) available to human beings has been used in mice: it restores fertility in old female mice. The…

Fast divisionless computation of binomial coefficients

, 3 min read

Suppose that I give you a set of n objects and I ask you to pick k distinct objects, thus forming a new subset. How many such subsets are there? If you have taken college mathematics, you have probably learned that the answer is given by binomial coefficients. They are defined as n!/(k! * (n-k)!)…

Science and Technology links (February 22nd 2020)

, 2 min read

In a large cohort study, the highest probability of reaching 90 years old was found for those drinking between 5g and 15 g of alcohol per day. This does not mean that if you are not drinking, you should start. The Earth is getting greener thanks to CO2. In turn, a greener Earth will mitigate…

My thoughts on how research funding is attributed in Canada to Computer Science

, 5 min read

In Canada, most computer science professors seek funding with NSERC, the main Canadian funding agency for science and engineering. It is more or less the equivalent of the American NSF. The core NSERC program is called “discovery” and it funds 5-year research programs. So, roughly speaking,…

Science and Technology links (February 8th 2020)

, 2 min read

It is often believed that radiations are bad for you. To the contrary, David et al. report that life expectancy is approximately 2.5 years longer in people living in areas with an elevated background radiation in the USA.1. Birth order, that is whether you are the oldest or youngest sibling, is…

Research should not stop with the research paper

, 3 min read

The practice of academic research is based on the production of formal documents that undergo formal reviewers by peers. We routinely evaluate academics for jobs and promotions based on their publication output. When asked about their contribution to science, many academics are happy to point at…

Science and Technology links (February 1st 2020)

, 1 min read

Almost all climate predictions are based on the so-called “business as usual” model, yet this model is based on assumptions that are unrealistically pessimistic. (Source: Nature) African populations have Neanderthal ancestry. This might be indicative that people from Europe went back to Africa…

Cost of a thread in C++ under Linux

, 2 min read

Almost all our computers are made of several processing cores. Thus it can be efficient to “parallelize” expensive processing in a multicore manner. That is, instead of using a single core to do all of the work, you divide the work among multiple cores. A standard way to approach this problem…

Science and Technology links (January 25th 2020)

, 3 min read

Scientists found a way to increase the production of new neurons in the brains of mice, effectively rejuvenating the brains of old mice. (Source: Nature) How many people died during accidents at nuclear power plants? In North America, the most famous accident happened at Three Mile Island when a…

Filling large arrays with zeroes quickly in C++

, 2 min read

Travis Downs reports that some C++ compilers have trouble filling up arrays with values at high speed. Typically, to fill an array with some value, C++ programmers invoke the std::fill. We might assume that for a task as simple as filling an array with zeroes, the C++ standard library would provide…

Allocating large blocks of memory: bare-metal C++ speeds

, 2 min read

In a previous post, I benchmarked the allocation of large blocks of memory using idiomatic C++. I got a depressing result: the speed could be lower than 2 GB/s. For comparison, the disk in my laptop has greater bandwidth. Methodologically, I benchmarked the “new” operator in C++ with…

How fast can you allocate a large block of memory in C++?

, 3 min read

In C++, the most basic memory allocation code is just a call to the new operator: char *buf = new char[s]; According to a textbook interpretation, we just allocated s bytes1. If you benchmark this line of code, you might find that it almost entirely free on a per-byte basis for large values of s.…

Science and Technology links (January 11th 2020)

, 1 min read

The extra wealth that ones acquires by attending college is now estimated to be indistinguishable from zero. The authors control for the parent’s education and the individual’s financial acumen. A drug approved for use in human beings (Rapamycin) appears to rejuvenate dental health in…

How I teach database design

, 4 min read

Most software runs on top of databases. These databases are organized logically, with a schema, that is a formal description. You have entities (your user), attributes (your user’s name) and relationships between them. Typical textbook database design comes from an era when it was possible to…

My Science and Technology review for 2019

, 2 min read

I like to end every year with my selection of the most significant science and technology events. In 2019, you could buy a computer from Apple with 1.5 terabytes of memory. And by memory, I mean fast internal memory (RAM). Of course, it would cost tens of thousands of dollars. You and I are…

Science and Technology links (December 21st 2019)

, 1 min read

The number of research papers with more than 1000 authors is increasingly quickly and reaching many fields. Researchers at Facebook use neural networks to solve fancy algebraic problems that may be out of reach of computer algebra systems. At least on the short term, wind turbines may contribute…

Xor Filters: Faster and Smaller Than Bloom Filters

, 6 min read

In software, you frequently need to check whether some objects is in a set. For example, you might have a list of forbidden Web addresses. As someone enters a new Web address, you may want to check whether it is part of your black list. Or maybe you have a large list of already used passwords and…

A look back to my 2010 predictions for 2020

, 1 min read

Back in 2010, I wrote a post Who is going to need a database engine in 2020? Let me revisit some of my 2010 statements. Apple will sell desktops with 1 TB of RAM in 2020. I am sure that the prediction sounded insane back in 2010, but it actually happened. A Mac Pro can have up to 1.5TB of RAM…