Daniel Lemire's blog

Should you get a PhD?

, 5 min read

Most people like to learn, some like it more than others… and they decide to focus their life on learning. They become scholars. I think it is a mistake to pursue a Ph.D. for its own sake but it is not a mistake to pursue scholarship. In the good old days, people received a Ph.D. as a recognition…

Elegance as a luxury

, 3 min read

As a young student, I was undisciplined. Though I did well in mathematics, I often couldn’t be bothered to write down clean computations. I would do the work mostly in my head, and I would quickly jot down the answer. Such a strategy serves you well early on during your education. However, later…

Probabilities in computing: they may not mean what you think they mean

, 4 min read

I like to throw off my academic colleagues outside of computer science by pointing out that much of our software relies on probabilities… down to the ubiquitous hash table. They often expect software to be mostly designed around deterministic ideas. But probabilities are everywhere. One common…

The myth of the scientist as a disinterested individual

, 3 min read

We like to have an idealized view of the scientist. He or she is someone who chose against a high-paying career to pursue the ideals of science and academia. Unlike the greedy engineer or entrepreneur, he works not for himself, but for the greater good. We often hold similar views of politicians,…

Getting good performance in Go by rewriting parts in C?

, 3 min read

Go is a new programming language invented by Google engineers. Apparently, it came about because they were tired to wait for their C++ code to compile. To run Go programs, you need to compile them. However, compilation is so amazingly fast that Go may as well be an interpreted language like Python…

The rise to power of computer scientists

, 1 min read

Want to become CEO of a major technology company? Consider the background of the hot CEOs of the hour: Amazon: Jeff Bezos has a degree in electrical engineering and computer science. Apple: Tim Cook got a degree in industrial engineering. Facebook: Mark Zuckerberg studied computer science. Google:…

Compression is never worth slowing down your code?

, 1 min read

Should you ever compress your data to reduce memory usage? We are in 2050. Nobody uses tapes or disks anymore. The NSA has 1 billion servers. It needs so many to hold all of the data in memory. A contractor offers a marvellous algorithm that can compress data by a factor of 1,000,000,000. The…

To be smarter, try being crazier?

, 4 min read

Many of us want to be original in our work. For researchers, it is a job requirement. For software programmers, it makes little sense to redo what others did. Many of the people who did great things stood out by their originality. Great scientists like Nash are sometimes slightly or entirely mad.…

Are C++ and Java declining?

, 2 min read

In a recent Dr. Dobb’s article, Binstock announced the decline of Java and C++: By all measures, C++ use declined last year, demonstrating that C++11 was not enough to reanimate the language’s fortunes (…) Part of C++’s decline might be due to the emergence of competing native…

Why is the NSA grabbing all your private data?

, 2 min read

Snowden revealed to the world that the NSA was systematically spying on all of us. Maybe more critically, we have learned that the NSA is spying on all American citizens. In fact, the NSA is even spying on its own congress. This spying violates the US constitution. We also know that such spying is…

Why are there so many science PhDs?

, 2 min read

McArdle, an economist, recently wrote that a substantial fraction of PhD programs really shouldn’t exist. McGowan goes further by pointing out that there is little demand for science and technology PhDs. I can only agree. Meanwhile, the gap between tenure-track positions and the number of new…

Life is sweeter than you think in 2014…

, 2 min read

Jokingly, Rao pointed out that Americans are starting 2014 with an optimistic outlook: (…) it’s tough, but let’s just write off polar bears and groundwater pollution from fracking already and move on. But life is even sweeter than Rao thinks. Indeed, polar bears are not going extinct…

When delegating… consider quality, maintenance and learning

, 4 min read

John Cook provides some valuable advice today about when to delegate. An important point he raises is that doing a per-hour analysis makes little sense since human beings are not simple machines. For example, delegating low-pay work that you find enjoyable might not be financially wise despite…

Fastest way to compute the greatest common divisor

, 2 min read

Given two positive integers x and y, the greatest common divisor (GCD) z is the largest number that divides both x and y. For example, given 64 and 32, the greatest common divisor is 32. There is a fast technique to compute the GCD called the binary GCD algorithm or Stein’s algorithm. According…

On human intelligence… a perspective from computer science

, 2 min read

Whenever I read social scientists, there is often, implicit in the background, the concept of “intelligence” as a well defined quantity. I have some amount of intelligence. Maybe you have a bit more. But what does computer science have to say about any of this? That is, what is this…

Even faster bitmap decoding

, 2 min read

Bitmaps are a simple data structure used to represent sets of integers. For example, you can represent all sets of integers in [0,64) using a single 64-bit integer. When they are applicable, bitmaps are very efficient compared to the alternatives (e.g., a hash set). Unfortunately, extracting the…

The day I subscribed to a dozen porn sites…

, 2 min read

This morning, I noticed some odd charges on my VISA card. They were attributed to sites such as videosupport1.com, bngvsupport.com, paysupport1.com, bdpayhelp.com. I called up my bank. They gave me the phone number of the company behind these pay sites and told me to ask what the charges were…

Do we need academic copyright? Some historical perspective

, 3 min read

It is commonly believed that we introduced copyright to entice authors into producing lots of quality work by providing them with increased financial incentives. Despite the contrary evidence, many people still insist that without copyright law, we would not have Harry Potter or video games because…

Is programming as cool as basketball?

, 2 min read

Some of the best job prospects are in the software industry. Programming as a career has several benefits worth considering: though not stellar, the pay can be quite good (e.g., 6 figure salaries are common), you do not need many years of study (e.g., some do not even have a degree), there aren’t…