Atom

Performance guide

Create a contiguous buffer

When measuring a numeric workload, compare the representation you actually use. Here a packed array reserves space for four 64-bit floats.

Atom
use binary
values = create(f64, 4)
print(binary.size(values))
Output
32

Four eight-byte slots occupy 32 bytes of packed storage. Profile the complete task before changing representations.

  • Begin with the VM and representative data. Dynamic arrays and dictionaries fit heterogeneous application state and object-like records. Use packed storage for contiguous numeric loops, reusable layouts, structured binary I/O and native calls that need a predictable stride.
  • Allocate a known packed capacity with create(layout, count). Reuse layout descriptors, views and buffers where this fits the application. Ordinary packed element views alias their owner. Copy a view when ownership needs to be independent.
  • Keep working sets and temporary output bounded. Join text fragments with text.join when building a large result from many parts. Text is immutable and repeated concatenation can allocate and copy each intermediate string. Scalar indices search UTF-8 bytes, so iterate directly when visiting all scalars.
  • Consider batching calls crossing FFI and worker boundaries. A worker clones transferable state and has its own VM. Use workers when parallel jobs are large enough to justify startup and transfer. Use coroutines when a single thread needs to step multiple pieces of work cooperatively.
  • Measure warm-up and steady execution separately. The repository benchmark driver measures startup, compilation, elapsed time, resident memory and artifact sizes for workloads in benchmarks/workload.atom. Its steady measurements compare warm-up and longer runs and check cumulative results. CLI profiling counts interpreter and native activity. It adds accounting overhead, so use separate regular runs for elapsed time.
  • The conformance native-execution workload executed 92,188 instructions in each mode on the Linux build used to validate this reference. JIT reported 79,437 native instructions after warm-up and AOT 91,643. These counters establish which paths ran. Timing the workload under comparable conditions is required for a speed comparison.