Tagged articles
6 articles
Page 1 of 1
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 11, 2023 · Backend Development

Performance Comparison of List.sort() vs Stream.sorted() in Java and Optimization Techniques

The article analyzes why a Java API endpoint took eight seconds, demonstrates through benchmarks that List.sort() outperforms Stream.sorted(), shows how sorting on computed columns and using BigDecimal can drastically slow execution, and presents three practical optimizations that reduce the response time to under a second.

BigDecimalJavalist.sort
0 likes · 8 min read
Performance Comparison of List.sort() vs Stream.sorted() in Java and Optimization Techniques
Architect's Tech Stack
Architect's Tech Stack
Aug 22, 2023 · Backend Development

Why List.sort() Is Faster Than Stream.sorted() in Java: Benchmarks and Analysis

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
Why List.sort() Is Faster Than Stream.sorted() in Java: Benchmarks and Analysis
Top Architect
Top Architect
Aug 13, 2023 · Backend Development

Why List.sort() Is Faster Than Stream.sorted() in Java

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.

BenchmarkJMHJava
0 likes · 11 min read
Why List.sort() Is Faster Than Stream.sorted() in Java
Java Backend Technology
Java Backend Technology
Aug 10, 2023 · Backend Development

Why list.sort() Beats stream().sorted() in Java: Benchmarks and Insights

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.

BenchmarkJMHJava
0 likes · 9 min read
Why list.sort() Beats stream().sorted() in Java: Benchmarks and Insights