Skip to content

Nihil v4.14.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 02:14
· 74 commits to main since this release
f7d6e35

On a Mac, the native collector does less work and wastes less memory; maps add to a key in one call; and writing a table
no longer makes its whole text first. bench/workload (1,000,000 sales) went from 205 to 171 ms on an M4 (1.2 times C,
0.6 times Go), and its peak memory from 176 to 149 MB. The translator of the x86-64 code (NIHIL_TRANSLATE=1) stays one
more version.

  • maps: m[k] = (m[k] || d) + e; on a map of INT values is one call that finds the slot once and adds in place
    (docs/map-upsert.md), where it was a read and a write; d an INT literal, e names, numbers, fields, indexes and
    arithmetic with no call, so nothing can tell the two apart but the time. Off with -O0
    • Why: The commonest update of a map, a count or a total by key. bench/workload's map phase on an M4: 43 → 38 ms
      with -native
  • @>> path, rows; writes the table about 1 MB at a time instead of making its whole text first (SPEC §20), on Linux
    and on macOS: the same file, written the same way (a temporary, synced and renamed), and the same errors, with the
    file left untouched when a field does not fit
    • Why: 1,000,000 records make a 21 MB text that was garbage as soon as it was written. A program whose peak is the
      write (a million records, then @>>) goes from 101 to 81 MB on an M4. bench/workload keeps its peak, which is
      later (the sales and the rows read back, both alive)
  • macOS: the native collector does not look inside a record whose fields are all INT, FLOAT or BOOL (made by its
    model or read from a table; not yet those the prelude makes, such as [r ; n] and from_json): no address can be
    in it
    • Why: bench/workload's million sales are such records: its table phase went from 124 to 114 ms and generate from
      25 to 23 ms on an M4
  • macOS: the native collector has 41 block sizes instead of 21 (32, 40, 48, 56, 64, 80 … 32768: four to a doubling),
    so a block wastes at most a fifth of itself instead of a third
    • Why: A record of five fields takes 56 bytes and was given 64. bench/workload (1,000,000 sales, two copies of
      them) peaks at 159 MB instead of 176, with 2% fewer instructions and the same time
  • macOS: the native collector marks a small block it does not look inside (a text, a record of numbers only) without
    putting it on its stack of blocks to scan
    • Why: It was put there and taken off again to no purpose, a million times a collection in bench/workload.
      Marking 1,000,000 such records takes a half to a third of the time; the workload runs 5% fewer instructions
      (generate 22 → 19 ms) and peaks at 149 MB instead of 159 (the stack no longer grows to a million entries)
  • fix: macOS -native: closing a descriptor (__nihil_syscall([3, fd])) gives the system's answer (0 or -errno,
    Linux's numbers) instead of always 0, as on Linux; a directory's descriptor is closed once, by its closedir

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux x86_64, and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.