Skip to content

Zeno 0.4.0

Choose a tag to compare

@github-actions github-actions released this 16 Nov 19:57

Zeno 0.4 has a way to build that is as fast as C and Rust,
zeno build --fast, and it mends what the release of 0.3.0 found on
macOS.

Installing

Windows: download zeno-0.4.0-windows-setup.exe below and run it.
It is not signed, so Windows warns the first time: "More info", then
"Run anyway".

macOS and Linux:

curl -fsSL https://github.com/partham20/zeno-lang/releases/download/v0.4.0/install.sh | sh

Both put zeno on the PATH and offer to install a C compiler and git
if the machine has none.
docs/install.md
says what they do. The archives further down are for installing by
hand.

Homebrew, on macOS and Linux:

brew tap partham20/zeno-lang https://github.com/partham20/zeno-lang
brew install partham20/zeno-lang/zeno

With another package manager. There is a package for apt, pacman,
snap and flatpak, installed from its file:

sudo apt install ./zeno_0.4.0_amd64.deb                         # Debian, Ubuntu, Raspberry Pi OS
sudo pacman -U zeno-lang-bin-0.4.0-1-x86_64.pkg.tar.zst         # Arch
sudo snap install --classic --dangerous zeno_0.4.0_amd64.snap
flatpak install --user zeno-0.4.0-x86_64.flatpak

The .deb is also there for arm64, armhf (every Raspberry Pi with
a 32-bit system) and i386, the snap for arm64 and armhf, and the
flatpak for aarch64. apt installs a C compiler and git along with
Zeno if the machine has none.

docs/stores.md
says where each manager finds Zeno by itself, with no file, and what is
still to be done for the ones that do not yet.

zeno build --fast

A new way to build, for a program whose tests pass, when every last bit
of speed matters. It leaves out the checks a correct program never
fails, as C does: a list index out of range, a float divided by zero,
the square root of a number below zero, and the overflow of a whole
number. The C compiler is asked for -O3. Every other build keeps all
its checks.

Overflow is where it differs from --release. With --release a sum
that overflows wraps round. With --fast it has no defined result, as
in C, and the C compiler builds on its not happening. That is what
makes a loop of whole numbers the same instructions a C program gets:
on the loop benchmark --fast runs 300.27 million instructions where C
runs 300.26 million. An overflow is an error in Zeno, so a program that
runs clean under zeno run has none (docs/memory-modes.md, decision
23.6).

On the six benchmarks, counted in instructions, --fast --owned runs
no more than C on five of the six, far fewer on two of them, and 6%
more on the sixth (fib, where the time is the same); the times are in
bench/README.md. Rust is ahead on one, nbody, because its compiler
knows there are exactly five bodies; with the number hidden from it,
it is behind both C and Zeno (decision 23.4).

Faster in every build

  • A number becomes text (str(n), {n}) several times faster, without
    snprintf.
  • In an owned program, a big list grows with realloc, as a C array
    does, instead of being copied each time it doubles.
  • x // 8 and x % 8, by 2, 4, 8 and so on written as a number, are
    one shift and one mask, with nothing to check. % and // by any
    other number take fewer instructions than they did (decision 23.5).
  • xs.append(x) is a compare, a store and a count in the loop that
    appends, not a call (decision 23.8).

Benchmarks that can be trusted to one in a hundred

python3 bench/run.py --count counts the instructions each program
runs, under valgrind. The count is the same on every run, where a time
on a busy machine moves by a tenth. Timed runs now go in rounds, each
engine once per round. Both sets of numbers are in bench/README.md
(decision 23.7).

The two generations of the collector, on macOS too

0.3.0 had the collector's two generations on Linux only: on macOS they
made programs built with zeno build --llvm hang. The cause is found
and mended (see below), so a program built on macOS now has them too,
and most of its collections look only at the blocks made since the
last one. On Windows every collection still looks at everything.

Mended

  • On macOS, in a program built with zeno build --llvm, catching an
    error with try could leave signals held back from then on: Ctrl-C
    no longer stopped the program. A try remembered its place in one
    way and raise went back to it in another, and the two did not
    agree about signals. This was in 0.2.0 and 0.3.0. Programs built
    with plain zeno build were right.
  • The release of 0.3.0 left packaging/arch/.SRCINFO in the
    repository at 0.2.0, beside a PKGBUILD of 0.3.0. A release now
    keeps both.

The archives

Machine File
Linux, x86-64: most PCs and servers zeno-0.4.0-linux-x86_64.tar.gz
Linux, ARM64: a Raspberry Pi 3, 4 or 5 with a 64-bit system, ARM servers zeno-0.4.0-linux-arm64.tar.gz
Linux, 32-bit ARMv7: a Raspberry Pi 2 or later with a 32-bit system zeno-0.4.0-linux-armv7.tar.gz
Linux, 32-bit ARMv6: a Raspberry Pi 1 or Zero zeno-0.4.0-linux-armv6.tar.gz
Linux, 32-bit x86 zeno-0.4.0-linux-x86.tar.gz
macOS, Apple silicon zeno-0.4.0-macos-arm64.tar.gz
macOS, Intel zeno-0.4.0-macos-x86_64.tar.gz
Windows, x86-64 zeno-0.4.0-windows-x86_64.zip
Windows, 32-bit x86 zeno-0.4.0-windows-x86.zip
Windows, ARM64 zeno-0.4.0-windows-arm64.zip

Unpack it and put zeno (zeno.exe on Windows) somewhere on your
PATH. To build web pages, put zeno.wasm from the same folder
beside it. The folder also holds the docs, the examples and the editor
setup.

tar -xzf zeno-0.4.0-linux-x86_64.tar.gz
cd zeno-0.4.0-linux-x86_64
./zeno --version
./zeno build --release examples/hello.zeno && ./hello

On macOS, a program downloaded with a browser is held back because
Apple has not signed it. xattr -d com.apple.quarantine zeno lets it
run.

zeno build hands the C it writes to a C compiler, so it needs one:
cc, gcc or clang, whichever it finds first, or the one CC
names. zeno build --llvm needs clang. zeno fetch needs git. zeno build --web and everything else need nothing.

What was checked

As for 0.3.0, every build but the Windows one for ARM64 was run before
it was released, and each one that was run also built the page of
examples/todo.zeno. The whole test suite, 514 tests, passes on Linux
x86-64, on macOS on Apple silicon and on Windows x86-64.

The setup program for Windows was installed, run and uninstalled on a
Windows machine, and install.sh the same on Linux and on macOS. Each
package was installed, run and removed: the .deb, the snap and the
flatpak on Ubuntu, the pacman package in Arch, and the Homebrew
formula on macOS.

The benchmarks were timed and counted on one machine, Linux on x86-64.
The two generations of the collector are on Linux and macOS. On
Windows, and on a chip, every collection looks at everything.