Tagged articles
JMH
58 articles · Page 1 of 1
The article walks through four carefully designed JMH benchmarks—method inlining, SIMD vectorization, lock elimination, and a Netty AsciiString regression—to show how JVM JIT optimizations appear in assembly, explain the performance impact (up to 1500×), and demonstrate how to diagnose and fix real‑world issues using assembly analysis.
JITJMHJava
0 likes · 19 min read

This article provides a comprehensive guide to Java MethodHandle, covering its differences from reflection, step‑by‑step creation (Lookup, MethodType, finding handles, invocation), advanced techniques like binding and dropping arguments, array spreading, and a JMH performance comparison with reflection, all demonstrated in a Spring Boot 3.4.2 environment.
JMHJavaReflection
0 likes · 10 min read

A Spring Boot 3.4.2 tutorial compares four entity‑to‑DTO conversion strategies—manual mapping, MapStruct, JPQL DTO projection, and JPQL record projection—using JMH benchmarks on an H2 in‑memory database, revealing that JPQL projection is roughly three times faster than the other approaches.
DTOJMHJPA
0 likes · 9 min read

This article explains microbenchmarking concepts, demonstrates how to use the Java Microbenchmark Harness (JMH) to accurately measure and compare the performance of specific code snippets such as synchronized methods, and provides practical guidance for integrating JMH into Java projects for reliable performance testing and regression analysis.
ConcurrencyJMHJava
0 likes · 11 min read

This article explains Java object pooling using Commons Pool 2 and HikariCP, covering their core classes, configuration parameters, practical examples with Redis and JDBC, interview questions, and JMH performance benchmarks that demonstrate significant throughput improvements.
Commons Pool 2Database Connection PoolHikariCP
0 likes · 14 min read

This article examines eight common Java string concatenation techniques, benchmarks them with JMH, presents the performance results—including a clear ranking where the '+' operator outperforms others—and provides a downloadable Spring Boot 3 case collection for deeper learning.
JMHSpring BootString Concatenation
0 likes · 9 min read

This article explains the principles of object pooling in Java, introduces the Commons Pool 2 library and its use in Redis client Jedis, compares pool and non‑pool performance with JMH benchmarks, and details the fast HikariCP database connection pool along with configuration tips and interview questions.
Commons-PoolHikariCPJMH
0 likes · 15 min read

This article explains functional programming concepts in Java, including immutability, stateless functions, higher‑order functions, closures, currying, recursion, lazy evaluation, and referential transparency, and demonstrates each with practical code samples and JMH performance benchmarks.
JMHfunctional programminghigher-order functions
0 likes · 13 min read

Using JMH, the author benchmarks Java's switch‑case against if‑else and finds switch executes in about 0.44 ns per operation versus 1.55 ns for if‑else, with the gap widening as the number of branches increases.
JMHJavabenchmark
0 likes · 5 min read

This article implements seven different HashMap traversal techniques in Java, benchmarks each with JMH, and shows that lambda‑based iteration and entrySet loops are the fastest, followed by Streams, while keySet‑based loops lag behind.
HashMapJMHJava
0 likes · 12 min read

This article introduces JMH, explains why it outperforms simple loops or other tools, and provides step‑by‑step Maven setup, benchmark creation, execution, and advanced annotations such as @Warmup, @Fork, @Setup, Blackhole usage, and SpringBoot integration for accurate Java micro‑benchmarking.
JMHMavenSpringBoot
0 likes · 12 min read

This article compares Java's standard ThreadLocal with Netty's FastThreadLocal, explains their internal mechanisms, shows practical code examples, runs a JMH microbenchmark, and discusses performance, memory management, and usage scenarios to help developers choose the right thread‑local storage solution.
ConcurrencyFastThreadLocalJMH
0 likes · 11 min read

A developer debates whether placing a try‑catch block inside a Java for‑loop impacts performance, runs JMH benchmarks comparing try‑catch inside the loop versus around it, examines bytecode differences, references Effective Java’s warnings, and concludes the overhead is minimal unless exceptions are actually thrown.
Exception HandlingJMHJava
0 likes · 7 min read

This article introduces JMH, explains its key features, and presents microbenchmark results comparing thread‑exclusive, thread‑shared, Snowflake, UUID, and Snowflake‑algorithm GUID generation methods under various thread counts, accompanied by the full Java test code.
GUIDJMHJava
0 likes · 8 min read


政采云技术Jan 25, 2024 · Fundamentals
This article provides a comprehensive overview of the major language and runtime enhancements introduced in JDK 12 through JDK 17, covering switch expressions, micro‑benchmarking with JMH, class‑data sharing, garbage‑collector improvements, new String methods, hidden and sealed classes, records, and unified asynchronous logging, all illustrated with code examples.
JDKJMHJava
0 likes · 23 min read

This article benchmarks the cost of instantiating a new ObjectMapper for each JSON conversion in a SpringBoot project, demonstrates a singleton implementation that boosts read performance by 18× and write performance by up to 300×, and shows how to add custom serializers without sacrificing speed.
JMHJavaObjectMapper
0 likes · 8 min read

Using Jackson's ObjectMapper for JSON parsing, this article benchmarks three approaches—creating a new mapper per call, sharing a global singleton, and using ThreadLocal—revealing that a single shared ObjectMapper can achieve up to ten times higher throughput, while ThreadLocal offers only modest gains.
JMHJSONJackson
0 likes · 7 min read

This article investigates the performance difference between Java's List.sort() and Stream.sorted(), providing simple demos, JMH benchmark results, and analysis of underlying overheads to explain why the native list sorting is generally faster than sorting via streams.
JMHJavalist.sort
0 likes · 8 min read

This article explains why measuring Java code performance is essential, introduces the JMH microbenchmark framework, details its key annotations and configuration options, and provides step‑by‑step instructions and code examples for building, writing, and running benchmarks to obtain reliable results.
JMHJavabenchmark
0 likes · 12 min read

This article examines the performance difference between Java's List.sort() and Stream.sorted() by presenting simple demos, discussing JIT warm‑up effects, and using JMH benchmarks to show that native list sorting generally outperforms the stream‑based approach.
JMHJavabenchmark
0 likes · 9 min read

This article explains how repeatedly creating Jackson ObjectMapper instances hurts performance, demonstrates a JMH benchmark comparing new, singleton, and ThreadLocal ObjectMapper usages, and concludes that a single globally shared ObjectMapper can achieve up to ten times faster JSON parsing.
JMHJacksonJava
0 likes · 8 min read

An in‑depth comparison shows that Java's native List.sort() outperforms Stream.sorted() due to lower overhead, demonstrated through simple demos, JMH micro‑benchmarks across various collection sizes, and analysis of stream processing costs, concluding that the performance gap, while measurable, is often negligible in typical use.
JMHJavalist.sort
0 likes · 11 min read

This article investigates the performance difference between Java's native List.sort() method and the Stream.sorted() approach, provides simple demos, explains JIT warm‑up effects, and presents JMH benchmark results that show List.sort() consistently outperforms Stream.sorted() for typical collection sizes.
JMHJavabenchmark
0 likes · 11 min read

This article investigates whether Java's list.sort() truly outperforms stream().sorted() by presenting simple demos, explaining the pitfalls of naive timing, and using JMH benchmarks to reveal that list.sort consistently runs faster due to lower overhead, while the performance gap remains small for typical data sizes.
JMHJavabenchmark
0 likes · 9 min read

This article explains Java object pooling concepts, introduces the Commons Pool 2 library, demonstrates its use with Redis via Jedis, compares performance with JMH benchmarks, and discusses the high‑performance HikariCP database connection pool, including configuration tips and common interview questions.
HikariCPJMHJava
0 likes · 15 min read

This article explains the principles of object pooling in Java, introduces the Commons Pool 2 library, demonstrates its use with Redis client Jedis, compares performance with JMH benchmarks, and discusses the high‑performance HikariCP database connection pool, including configuration tips and interview questions.
Commons-PoolHikariCPJMH
0 likes · 14 min read

This article explains the principles of object pooling in Java, introduces the Commons Pool 2 library, demonstrates its use with Redis client Jedis, compares performance with JMH benchmarks, and details the configuration and advantages of the high‑performance HikariCP database connection pool.
Commons-PoolHikariCPJMH
0 likes · 17 min read

This article explains why simple timing is unreliable in Java due to JIT compilation, introduces the official JMH tool for microbenchmarking, outlines best‑practice tips, demonstrates how to set up a Maven project, write benchmark code, run tests, interpret results, and details each JMH annotation.
JMHJavaMaven
0 likes · 14 min read

This article benchmarks the Groovy 'as' type‑conversion keyword against native Java conversion methods for String‑to‑double, double‑to‑String, and double‑to‑int operations using JMH, revealing that Java's built‑in approaches consistently outperform Groovy's 'as' keyword across various test cases.
GroovyJMHJava
0 likes · 8 min read

This article explains what benchmarking is, introduces the JMH framework for Java, shows how to add JMH dependencies, walks through a simple "Hello JMH" example with full source and output, demonstrates using JMH with Spring Boot, details the most important options and annotations, and highlights common pitfalls to avoid when writing reliable micro‑benchmarks.
JMHJavaSpring Boot
0 likes · 17 min read

This article explains how to quickly benchmark Java code performance, introduces the JMH microbenchmarking tool, provides sample JMH benchmark code comparing System.currentTimeMillis() and System.nanoTime(), and presents the results showing nanoTime's superior throughput.
JMHJavaSystem.nanoTime
0 likes · 6 min read

A practical benchmark compares placing a try‑catch inside a Java for‑loop versus wrapping the loop with try‑catch, revealing that the performance difference is negligible and that the real impact depends on exception frequency and code design rather than the try‑catch placement.
Effective JavaJMHJava
0 likes · 6 min read

This article benchmarks the serialization and deserialization performance of four popular Java JSON libraries—Gson, Fastjson, Jackson, and Json‑lib—using JMH, analyzes the results across different operation counts, and provides guidance on selecting the most suitable library for high‑performance applications.
FastjsonGsonJMH
0 likes · 11 min read

This article introduces Java Microbenchmark Harness (JMH), explains why warm‑up is necessary, details common annotations, shows how to set up a Maven project, provides a complete benchmark example comparing LinkedList iteration methods, and demonstrates how to run and interpret the results.
JMHJavaMaven
0 likes · 13 min read

This article introduces JMH, the official Java microbenchmarking tool, explains why warm‑up is needed, shows how to build a Maven project, provides a complete LinkedList iteration benchmark example, demonstrates common JMH annotations, and outlines how to run and interpret benchmark results.
JMHJavaMaven
0 likes · 16 min read

This article explains why pooling costly resources like database connections improves performance, introduces the Commons Pool 2 library and its core classes, demonstrates a Jedis pool with JMH benchmarks showing a 5× throughput boost, and dives into HikariCP's optimizations, configuration tips, and common interview questions.
Commons-PoolHikariCPJMH
0 likes · 15 min read

This article explains Java object pooling concepts, introduces the Commons Pool 2 library and its usage with Redis's Jedis client, compares it with the high‑performance HikariCP database connection pool, and presents JMH benchmark results demonstrating significant throughput gains, while also covering configuration parameters and interview questions.
Commons-PoolDatabase ConnectionHikariCP
0 likes · 15 min read

This article compares the performance of Java 16’s Stream.toList(), Collectors.toList() and Collectors.toUnmodifiableList() by running JMH benchmarks on different data sizes, revealing that Stream.toList() consistently outperforms the others in throughput, average latency, and cold‑start time.
Immutable ListJMHJava
0 likes · 9 min read

This article introduces Java Microbenchmark Harness (JMH), explains why warm‑up is needed, walks through project setup with Maven, demonstrates benchmark code for LinkedList iteration, details common JMH annotations, shows how to run and interpret results, and concludes with practical usage tips, while also mentioning a promotional book giveaway.
AnnotationsJMHJava
0 likes · 12 min read

This article examines the performance impact of instantiating a new Jackson ObjectMapper for each JSON parsing operation versus reusing a global instance, using JMH micro‑benchmarks to show that a shared ObjectMapper can be up to ten times faster.
JMHJacksonJava
0 likes · 7 min read

This article benchmarks three ObjectMapper usage patterns—creating a new instance per call, sharing a global singleton, and using ThreadLocal—demonstrating that a single shared ObjectMapper can achieve up to ten‑fold higher throughput in JSON parsing.
JMHJacksonJava
0 likes · 7 min read

This article introduces Java Microbenchmark Harness (JMH), explains why warm‑up is needed, shows how to build a benchmark project with Maven, provides a complete LinkedList iteration benchmark example with all relevant JMH annotations, demonstrates execution commands, and interprets the resulting performance reports.
AnnotationsJMHJava
0 likes · 13 min read

This article explains how to use JMH for precise Java micro‑benchmarks, covering JVM warm‑up, project setup with Maven, writing benchmark methods, configuring annotations, running tests, interpreting results, and provides practical code examples and tips for reliable performance measurement.
JMHJVMJava
0 likes · 13 min read

This article examines the performance of four Java integer-to-string conversion methods—Integer.toString, String.valueOf, a+"", and ""+a—by conducting raw loop tests and detailed JMH microbenchmarks, analyzing JVM warm-up, JIT, and OSR effects to reveal reliable measurement practices.
JITJMHJava
0 likes · 25 min read

This article walks through a real‑world Java logging slowdown, explains how to benchmark the code with JMH, and shows step‑by‑step usage of Arthas commands like monitor, trace, and watch to pinpoint the exact cause of the performance regression.
ArthasJMHJava performance
0 likes · 18 min read

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

This article introduces JMH, the Java Microbenchmark Harness, explains why traditional main‑method benchmarks are unreliable, and provides step‑by‑step instructions, code examples, and best‑practice annotations for accurately measuring method‑level performance in Java applications.
JITJMHJVM
0 likes · 20 min read

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.
JMHJavaSystem.currentTimeMillis
0 likes · 13 min read

This article examines the thread‑safety of the volatile keyword under multi‑write scenarios, demonstrates its failure with a concurrent counter test, and benchmarks LongAdder against AtomicInteger using JMH, revealing LongAdder’s superior performance under high contention and AtomicInteger’s advantage in low‑contention environments.
ConcurrencyJMHJava
0 likes · 8 min read

This article introduces JMH, explains how to add dependencies, write and run microbenchmarks for string concatenation, describes key annotations, highlights common pitfalls, and shows how to package, visualize, and integrate JMH benchmarks within Java projects.
JMHJVMJava
0 likes · 14 min read

This article benchmarks Java's switch statement against equivalent if‑else chains using JMH, explains the underlying bytecode differences, shows how tableswitch and lookupswitch are generated, and demonstrates that switch can be up to 3.7 times faster as the number of branches grows.
JMHJavabytecode
0 likes · 16 min read

An in‑depth Java performance study explores LongAdder, compares it with AtomicLong and lock‑based counters using JMH, and walks through successive custom implementations (V0‑V5) that apply striping, modulo optimization, false‑sharing elimination, and advanced hash probing to approach or surpass LongAdder’s throughput.
JMHJava ConcurrencyLongAdder
0 likes · 16 min read

JMH is a Java harness that enables precise, reproducible microbenchmarking through annotations, state management, threading, and profiling, and this guide walks through its core features—benchmark modes, state scopes, setup/teardown, fork control, blackholes, and advanced options—illustrated with sample code and results.
JMHJavabenchmarking
0 likes · 18 min read

This article explains how java.util.concurrent.atomic.LongAdder provides a more efficient counting mechanism than AtomicLong under high contention, discusses its trade‑offs in space and precision, presents JMH benchmark results, and walks through the internal implementation details such as cells, CAS loops, and hash‑based distribution.
CASConcurrencyJMH
0 likes · 13 min read

Using JMH, this article benchmarks the serialization and deserialization performance of four popular Java JSON libraries—Gson, Fastjson, Jackson, and Json-lib—by testing various scenarios with a complex Person model, analyzing results, and providing guidance on selecting the most suitable library for high‑performance applications.
FastjsonGsonJMH
0 likes · 13 min read

This article explains the purpose of UUIDs, common use cases, compares several Java UUID generation libraries, and presents JMH benchmark results showing that the mica implementation based on Java 9 outperforms JDK 8 ThreadLocalRandom and Hutool FastSimpleUUID by three to four times.
JMHJavaUUID
0 likes · 4 min read

This article introduces Java Microbenchmark Harness (JMH), explains why precise benchmarking matters, and walks through twelve typical testing pitfalls—such as dead‑code elimination, constant folding, loop misuse, fork isolation, method inlining, false sharing, branch prediction, and multithreading—showing how JMH helps developers obtain reliable performance measurements.
JITJMHJava
0 likes · 25 min read

This article investigates the performance differences between the Connection and Template modes of Venus‑cache, presenting test scenarios on physical and cloud servers, analyzing throughput, lock contention, and thread behavior, and offering a solution to improve QPS by optimizing connection handling.
Connection PoolingJMHJava
0 likes · 8 min read
