Only 40 lines of code

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A 40-line code change in OpenJDK eliminated a 400x performance gap by replacing proc file reading with clock_gettime() for thread CPU time measurement. The old implementation opened proc files, parsed strings, and converted numbers back from text, spending 90% of time on file operations. The new approach uses a direct system call, reducing execution time from 11 microseconds to 279 nanoseconds. Flame graphs visualize the dramatic reduction in overhead, showing how most time was previously wasted on file handling rather than actual computation.

7m watch time
10 Comments

Sort: