Daniel Lemire's blog

Nobel-prize winner Romer on innovation and higher education

, 3 min read

Romer was one of the the winners of the Nobel prize in economics this year (2018). He wrote about higher education and innovation. One of his proposals is the introduction of more generous scholarships for students in science and engineering. His starting point is that to innovate and get richer,…

Validating UTF-8 bytes (Java edition)

, 2 min read

Strings are just made of bytes. We send and receive bytes over the network all the time. If you know that the bytes you are receiving form a string, then chances are good that it is encoded as UTF-8. Sadly not all streams of bytes can be valid UTF-8 strings. Thus you should check that your bytes…

Science and Technology links (October 13th, 2018)

, 3 min read

Chronic exposure to canola oil results in a significant increase in body weight and impairments in working memory… in mice. (Source: Nature) Belly fat is not just fat in reserve, it signals your body through hormones. Some of these signals might be helpful, but some are not. Visceral fat is…

Smart bracelet: my experience with the Mi Band 3

, 3 min read

I was an early adopter of fitness bracelets with heart-rate monitoring. I use them to track my heart rate at rest. You heart rate should be around 65 if you are fit. If it goes much higher than 65, you might be getting unfit or you might have a medical condition. I also like to track the quality of…

Science and Technology links (October 6th, 2018)

, 1 min read

Ibuprofen extends lifespan in many species including, maybe, human beings. Donna Strickland is the third women to win a Nobel prize in Physics. It appears that she won the prize for one 1985 article. Her scientific publications are available on Google Scholar. She is maybe one more example of the…

Quickly parsing eight digits

, 3 min read

In my previous post, I described how we can quickly determine whether eight characters are made of digits (e.g., ‘13223244’). It takes a bit over 2 cycles. Suppose that you want to turn this string into an integer value. Most programmers would implement it as a simple loop: uint32_t…

Quickly identifying a sequence of digits in a string of characters

, 3 min read

Suppose that you want to quickly determine a sequence of eight characters are made of digits (e.g., ‘9434324134’). How fast can you go? In software, characters are mapped to integer values called the code points. The ASCII and UTF-8 code points for the digits 0, 1,…, 9 are the consecutive…

Science and Technology links (September 30th, 2018)

, 1 min read

Oculus is launching a new standalone virtual-reality headset next year, the Oculus Quest. It is the price of a console like the Nintendo Switch, and might have comparable computational power. It does not need to be tethered to a PC (it is wireless). It should have top-notch virtual reality with…

Science and Technology links (September 22nd, 2018)

, 3 min read

Apple benefits from the chip-making technology of a company called TSMC. This company has surpassed Intel in transistor density. Thus, in some sense, the microprocessors in Apple’s latest iPhone are more advanced than the microprocessors you find in brand-new PCs. Here is a provocative opinion…

On the state of virtual-reality gaming

, 3 min read

For nearly two years, I have been trying a wide range of video games in a virtual reality setting. Our lab. in Montreal has some permanent space dedicated to the HTC Vive, so I was also able to test out games with a wide range of people. I must have tried several dozen different games so…

Science and Technology links (September 15th, 2018)

, 1 min read

I was told repeatedly throughout my life that the normal body temperature was 37.5°C. This estimate is over a hundred years old and flawed. It is off by one degree: a better “normal” is 36.5°C. According to Malhotra et al., heart disease is a chronic inflammatory condition (meaning that it…

Science and Technology links (September 8th, 2018)

, 3 min read

Most research articles are not available for free to the public, even when the research was fully funded by the public. To legally access research articles, one typically needs to go through a college library which pays for access (often with public dollars). Major European agencies have thus…

AVX-512: when and how to use these new instructions

, 9 min read

Our processors typically do computations using small data stores called registers. On 64-bit processors, 64-bit registers are frequently used. Most modern processors also have vector instructions and these instructions operate on larger registers (128-bit, 256-bit, or even 512-bit). Intel’s new…

Per-core frequency scaling and AVX-512: an experiment

, 1 min read

Intel has fancy new instructions (AVX-512) that are powerful, in part for heavy numerical work. When a core uses these heaviest of these new instructions, the core’s frequency comes down to maintain the power usage within bounds. I wanted to test it out so I wrote a little threaded program. It…

Science and Technology links (September 1st, 2018)

, 5 min read

What causes the obesity epidemic? Archer et al. think the role of diet is overblown. Rather they believe that obesity is caused by reductions in physical activty below the Metabolic Tipping Point. Their argument is based on the fact that various human population have had various diets (including…

AVX-512 throttling: heavy instructions are maybe not so dangerous

, 2 min read

Recent Intel processors have fancy instructions operating over 512-bit registers. They are reported to cause a frequency throttling of the core where they are run, and possibly of other cores in some cases. Thus, it has been recommended to avoid AVX-512 instructions. I have written a series of blog…

Science and Technology links (August 24th, 2018)

, 5 min read

There is water on the surface of the Moon. This is important because if you want to build a long-term base on the Moon, having access to water is a great asset. Water can sustain life, but it can also be use to create fuel (e.g., hydrogen). Despite paying tens of thousands of dollars in tuition…

Trying harder to make AVX-512 look bad: my quantified and reproducible results

, 2 min read

Intel’s latest processors have fancy instructions part of the AVX-512 family. The AVX-512 instructions are useful for numerical work and sophisticated computing (e.g., cryptography, multimedia), but not necessarily useful for mundane tasks. Intel documents that the use of AVX-512 instructions can…