Tagged articles
2 articles
Page 1 of 1
Sohu Tech Products
Sohu Tech Products
Nov 20, 2019 · Fundamentals

Deep Dive into System.currentTimeMillis(): Implementation, Performance, and Time Sources across Platforms

This article investigates the implementation of Java's System.currentTimeMillis() on Windows, macOS, and Linux, measures its execution speed, explores the underlying native methods and OS time‑source mechanisms such as TSC, HPET, and RTC, and discusses performance implications and best practices for high‑frequency timestamp retrieval.

ClockSourceLinuxSystem.currentTimeMillis
0 likes · 21 min read
Deep Dive into System.currentTimeMillis(): Implementation, Performance, and Time Sources across Platforms
Programmer DD
Programmer DD
Sep 19, 2019 · Backend Development

Why System.currentTimeMillis Slows Down Under High Concurrency and How to Fix It

The article reveals that frequent or concurrent calls to Java's System.currentTimeMillis can become dramatically slower due to kernel transitions and clock‑source contention, demonstrates the slowdown with benchmark code, explains the native gettimeofday implementation, and proposes a cached‑timestamp solution using a single scheduler thread.

ClockSourceJavaSystem.currentTimeMillis
0 likes · 9 min read
Why System.currentTimeMillis Slows Down Under High Concurrency and How to Fix It