Tagged articles
6 articles
Page 1 of 1
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Jan 18, 2025 · Backend Development

How Java’s String.intern() Boosts Memory Efficiency and Performance

Java’s String.intern() method adds a string to the constant pool, enabling memory sharing and faster reference comparisons; this article explains its behavior, demonstrates usage with code examples, and discusses performance benefits and cautions for optimal use in real‑world applications.

JavaMemory OptimizationString
0 likes · 5 min read
How Java’s String.intern() Boosts Memory Efficiency and Performance
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 2, 2020 · Fundamentals

Optimizing Java String Usage: Avoid +=, Use StringBuilder, and Leverage intern()

This article analyzes the immutable nature of Java's String class, explains why direct concatenation with "+=" is inefficient, and demonstrates three optimization techniques—using StringBuilder, applying String.intern(), and careful use of Split—to dramatically improve performance and reduce memory consumption.

JavaOptimizationPerformance
0 likes · 14 min read
Optimizing Java String Usage: Avoid +=, Use StringBuilder, and Leverage intern()