Daniel Lemire's blog

A simple trick to get things done even when you are busy

, 2 min read

I have been overwhelmed with busy work for the last couple of weeks. Unavoidably, this has meant shorter emails, fewer follow-ups with collaborators and not as much blogging as I would like. I probably missed a few commitments as well. However, despite all the turmoil of responsibilities,…

Why I like the new C++

, 3 min read

I was reading Vivek Haldar’s post on the new C++ (C++11) and I was reminded that I need to write such a post myself. C++ is a standardized language. And they came up with a new version of the standard called C++11. Usually, for complex languages like C++, new versions tend to make things worse.…

What I do with my time

, 5 min read

I am not a very productive person. I also do not work long hours. However, I sometimes give the impression that I am productive. I have been asked to explain how I do it. Maybe the best answer is to explain what I do on a daily basis. We are Wednesday. Here is what kept me busy this week: Every…

The learning pill

, 2 min read

Shirky predicts that the bulk of higher education is being disrupted the same way the music industry was disrupted by MP3 files. Should we believe him? Let us run a thought experiment. Instead of online lectures disrupting higher education, imagine that someone has invented a learning pill. That…

Fast sets of integers

, 2 min read

Maintaining a set of integers is a common problem in programming. It can also be implemented in many different ways. Maybe the most common implementation uses a hashing (henceforth hashset): it provides optimal expected-time complexity. That is, we expect that it takes a constant time to add or…

Should you follow the experts?

, 2 min read

It is silly to say that ignorance is strength. However, the contrary statement is not follow the experts. The right knowledge is strength. The tricky part is that determining what you should know is just as hard as learning it. So, while the expert might be sitting on the shoulders of giants, these…

Is reading memory faster than writing on a PC?

, 5 min read

For human beings, reading is much faster than writing. The same is often true for computers: adding a record to a database may take an order of magnitude longer than reading it. But the speed differential can often be explained by the overhead of concurrency. For example, writing to a database may…

When is a bitmap faster than an integer list?

, 2 min read

You can represent a list of distinct integers no larger than N using exactly N bits: if the integer i appears in your list, you set the i th bit to true. Bits for which there is no corresponding integers are set to false. For example, the integers 3, 4, 7 can be represented as 00011001. As another…

You cannot scale creativity

, 3 min read

As a teenager, I was genuinely impressed by communism. The way I saw it, the West could never compete. The USSR offered a centralized and efficient system that could eliminate waste and ensure optimal efficiency. If a scientific problem appeared, the USSR could throw 10, 100 or 1000 scientists at…

Will I get a job with this degree?

, 3 min read

In Quebec, we have had massive student protests. Students were asking for free higher education. It seems that things have quieted down as the new government has vowed to freeze tuition in constant dollar. Though it is never spelled out as such, affordable higher education is viewed as a tool to…

How to be happier while annoying your wife

, 3 min read

About a year ago, I read Made by Hand: Searching for Meaning in a Throwaway World by Mark Frauenfelder. It is a simple book with a simple message. How to be happy? Frauenfelder thought that moving to tropical island might be it for him and his family. It failed. Location is not related to your…

How well does peer review work?

, 2 min read

Since the second world war, science has relied on what I call traditional peer review. In this form of peer review, researchers send their manuscript to journal. An editor then reviews the manuscript and if it is judged suitable, the manuscript is sent to reviewers who must make a recommendation.…

Fast integer compression: decoding billions of integers per second

, 4 min read

Databases and search engines often store arrays of integers. In search engines, we have inverted indexes that map a query term to a list of document identifiers. This list of document identifiers can be seen as a sorted array of integers. In databases, indexes often work similarly: they map a…

Will tablets kill PCs?

, 4 min read

I have always been a fan of the personal computer. I worked all summer once to buy myself a cloned PC XT. I probably would not be a computer science researcher without the personal computer. It has shaped my life. We may not remember, but the PC was a somewhat surprising disruption. You could…

Organizations would not pass the Turing test

, 1 min read

In Computer Science, we often informally judge intelligence by using the Turing test. The Turing test is quite simple: if you can convince an observer that you are a human beings, then you are probably at least as smart as a human being. Yet no organization could ever convince you that it is a real…

Your programming language does not know about elementary mathematics

, 2 min read

In Mathematics, we typically require equality to form equivalence classes. That is, it should be reflexive: A should be equal to A. Moreover, it should be symmetric: if A is equal to B, then B should be equal to A. Finally, it should be transitive: if A is equal to B, and B is equal to C, then A…

To improve your intellectual productivity

, 3 min read

We would all like to be smarter, to produce better software, better research papers or better art. It is not difficult to see that, by just about any metric, productivity amongst human beings follow a power law. For example, 80% of all research papers are written by 20% of the researchers. (I made…

Does time fix all?

, 3 min read

As an undergraduate, finding useful references was painful. What the librarians had come up with were terrible time-consuming systems. It took an outsider (Berners-Lee) to invent the Web. Even so, the librarians were slow to adopt the Web and you could often see them warn students against using the…

On feeding your CPU with data

, 2 min read

Can you guess the speed difference between these two lines of code? The first line of code does N additions: for (int i=0; i<N;i++) sum+=arr[i]; The second line of code does N/16 additions: for (int i=0; i<N;i+=16) sum+=arr[i]; A naive programmer might expect the second option to be 16…

A post-industrial point of view

, 2 min read

We can roughly sketch human history as follows: Initially, everything was expensive for human beings. Farming made food cheap. The industrial revolution made goods and services cheap. In the post-industrial age, we are making the design of new products and services cheap. Once you adopt this…