# A Valhalla Ticker in One int

DevFeed: [A Valhalla Ticker in One int](<https://devfeed.tech/articles/a-valhalla-ticker-in-one-int-124265.md>)

Original publisher: [Read original article](<https://inside.java/2026/11/09/inside-java-ticker-value-class/>)

Author: Per-Ake Minborg

Published: 2026-11-09T00:00:00Z

Content type: article

Language: en

Sources: [Inside Java](<https://devfeed.tech/sources/inside-java.md>)

Topics: [Project Valhalla](<https://devfeed.tech/topics/project-valhalla.md>), [JEP-401](<https://devfeed.tech/topics/jep-401.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Encoding](<https://devfeed.tech/topics/encoding.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [32-bit](<https://devfeed.tech/tags/32-bit.md>), [abbreviation](<https://devfeed.tech/tags/abbreviation.md>), [account](<https://devfeed.tech/tags/account.md>), [adopting](<https://devfeed.tech/tags/adopting.md>), [alignment](<https://devfeed.tech/tags/alignment.md>), [all](<https://devfeed.tech/tags/all.md>), [allowed](<https://devfeed.tech/tags/allowed.md>), [allows](<https://devfeed.tech/tags/allows.md>), [alphabet](<https://devfeed.tech/tags/alphabet.md>), [also](<https://devfeed.tech/tags/also.md>), [apis](<https://devfeed.tech/tags/apis.md>), [apple](<https://devfeed.tech/tags/apple.md>), [application](<https://devfeed.tech/tags/application.md>), [class](<https://devfeed.tech/tags/class.md>), [implementing](<https://devfeed.tech/tags/implementing.md>), [jdk-28](<https://devfeed.tech/tags/jdk-28.md>), [one](<https://devfeed.tech/tags/one.md>), [performance](<https://devfeed.tech/tags/performance.md>), [project-valhalla](<https://devfeed.tech/tags/project-valhalla.md>), [valhalla](<https://devfeed.tech/tags/valhalla.md>), [value](<https://devfeed.tech/tags/value.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

The example packs one to five uppercase letters, digits, or periods into a 30-bit `int`: six-bit character codes follow string order, with zero padding marking the end. This lets `compareTo` compare integers directly, while `length()` and `charAt()` read characters without decoding a string; `subSequence()` does decode and allocate one. The JDK 28 value-object feature may let HotSpot scalarize individual values or flatten concrete `Ticker[]` arrays, but these are JVM-dependent optimizations. A benchmark on one Apple M4 Pro/OpenJDK 28-internal build found a 1.47x median traversal speedup for a large flat value array versus an identity-class array; it did not measure construction, decoding, or interface calls, and results may vary. The article requires preview flags at compile and run time, notes the five-character limit does not match all exchange rules, and recommends measuring the application's actual workload.

## Source excerpt

Learn how to pack a short ticker symbol into one int with a value class implementing CharSequence and Comparable.