All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

OpenJDK Performance Fix: How Replacing /proc Parsing with a Syscall Eliminated 400x Slowdown

By

bluestreak

4mo ago· 9 min readenInsight

Summary

The article analyzes a specific OpenJDK commit that dramatically improved Java performance by replacing inefficient /proc file parsing with a direct syscall. The author examines how a 40-line code change eliminated a 400x performance gap in thread CPU time measurement on Linux systems. The fix involved replacing complex file I/O operations with a single clock_gettime() system call, revealing a 20-year-old optimization opportunity in the Linux kernel's thread CPU time tracking. The article provides technical details about the commit, explains the performance implications, and discusses the broader lesson about avoiding unnecessary file operations for system information retrieval.

Key quotes

· 4 pulled
The diffstat was interesting: +96 insertions, -54 deletions. The changeset adds a 55-line JMH benchmark, which means the production code itself is actually reduced.
static jlong user_thread_cpu_time(Thread *thread) { pid_t tid = thread->osthread()->thread_id(); char *s;
The article reveals a 20-year-old optimization opportunity in the Linux kernel's thread CPU time tracking.
The fix involved replacing complex file I/O operations with a single clock_gettime() system call.
Snippet from the RSS feed
A deep dive into an OpenJDK commit that replaced slow /proc file parsing with a single syscall, revealing obscure Linux kernel internals and a 20-year-old optimization opportunity.

You might also wanna read