Tagged articles
6 articles
Page 1 of 1
Java Backend Technology
Java Backend Technology
Jul 27, 2021 · Backend Development

Is System.currentTimeMillis Really a Performance Bottleneck? A Deep Dive with Benchmarks

After observing a middleware that caches System.currentTimeMillis, the author investigates whether this method truly suffers performance issues, debunks common myths with detailed analysis, benchmarks using custom and JMH tests, and concludes that System.currentTimeMillis performs adequately without needing custom caching.

JMHJavaSystem.currentTimeMillis
0 likes · 12 min read
Is System.currentTimeMillis Really a Performance Bottleneck? A Deep Dive with Benchmarks
Programmer DD
Programmer DD
Nov 16, 2020 · Backend Development

Is System.currentTimeMillis Really a Performance Bottleneck? A Deep Dive

This article investigates whether System.currentTimeMillis suffers from performance problems by examining custom caching implementations, analyzing common misconceptions, presenting benchmark data from both simple loops and JMH tests, and concluding that the native method is sufficiently fast for typical use cases.

BenchmarkJMHJava
0 likes · 13 min read
Is System.currentTimeMillis Really a Performance Bottleneck? A Deep Dive
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