Package dev.gmitch215.bytebox.text


package dev.gmitch215.bytebox.text
What makes String.format cost what it costs here, which nothing in a project has to name.

String.format and printf both go through java.util.Formatter, and the class library's version reaches a decimal formatter, a currency table and the locale data behind them from the single method that dispatches on the conversion character. Because that is one method, every conversion is reachable from every use, so a format string of "%s and %d" pays for all of it: 85 KB of WebAssembly after compression, against a hello world of 7 KB. The digits come from the platform instead, and Locale - 0.9 KB on its own - is what remains.

Formatter records what that costs in behaviour: %t and %a throw and name their replacements, a precision above 100 pads with zeros, and grouping is every three digits.

Since:
1.0.0
  • Class
    Description
    A type that formats itself, standing in for java.util.Formattable.
    The flags a Formattable is told about, standing in for java.util.FormattableFlags.
    A formatter, standing in for java.util.Formatter.
    A format string the formatter will not accept, standing in for java.util.IllegalFormatException.
    A specifier with no argument to fill it, standing in for java.util.MissingFormatArgumentException.
    Points java.util.Formatter and what it needs at the ones in this package.