Skip to content

APN Mojo 1.0.1

Latest

Choose a tag to compare

@anatolvitold anatolvitold released this 10 Oct 10:10

APN Mojo 1.0.1 makes Integer text in bases other than 10 fast for large values.

  • Bases 2, 4, 8, 16 and 32 format and parse in linear time. A 64 KiB integer prints in hexadecimal in 0.32 ms instead of 8.7 s, and in binary in 1.3 ms instead of 47 s.
  • Other bases work in chunks of as many digits as fit in 64 bits, about 25 times faster on large values. Decimal output under ConversionLimits takes the same path (10.9 s → 0.22 s at 64 KiB). Plain decimal text is unchanged.
  • Integer.to_bytes and Integer.from_bytes exchange the magnitude as bytes, in either byte order, in linear time.

The algorithms and measurements are in Exact text; the new methods are under Text and bytes.

Works with Mojo 1.1.x on Linux x86-64 and macOS arm64.

Install from the Modular community channel (available once modular/modular-community#392 is merged):

# pixi.toml
[workspace]
channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]
pixi add apn_mojo

Documentation: https://spellbound-mojo.github.io/apn_mojo/