Parsing time stamps faster with SIMD instructions

In this blog post, we discuss representing time as a time-stamp string in software. We explore the common format %Y%m%d%H%M%S, which includes the year, month, day, hours, minutes, and seconds. This format is convenient, as it is short, easy to read, and allows for chronological sorting. We also provide a code example in C for generating time stamps. The main problem we address is parsing these strings and converting them into an integer representation of the number of seconds since the Unix epoch. While the typical solution involves using functions like strptime, we propose a potentially faster approach using SIMD instructions. We provide an example of the code using Intel intrinsic functions and compare its performance to the standard C approach using a benchmark. The SIMD approach significantly reduces the number of instructions and is approximately six times faster.

https://lemire.me/blog/2023/07/01/parsing-time-stamps-faster-with-simd-instructions/

To top