Repository navigation
Releases
EnderScript 1.2.1
EnderScript 1.2.1 fixes the issues found in the 1.2.0 review. Windows x86 (32-bit) and x64 only. ARM64 builds but has not been run on real ARM hardware yet, so it is not included.
The syntax has not changed. Existing programs run as before.
Download
| File | For |
|---|---|
enderscript-1.2.1-windows-x86.zip |
Windows 32-bit |
enderscript-1.2.1-windows-x64.zip |
Windows 64-bit |
Extract it and run ender.exe <file.es>. Nothing to install. Use SHA256SUMS.txt to check the download.
Fixes
- Source files saved with a UTF-8 BOM (Notepad, PowerShell 5.1) are now accepted. 1.2.0 stopped with
unexpected byte 0xEF. - A program too large for the output buffer now stops with
error: program too largeinstead of writing past the buffer. - Reading strings with
inputno longer stops after about 4 MB in total. When the input area fills up, the runtime asks Windows for a new block, and strings already read stay valid.
Performance
- x86 loop heads are aligned to 16 bytes. Without it, fizz on x86 went from 198 ms to 276 ms depending on where the loop landed in memory.
- The x64 SSE zero-count loop handles 4 vectors per pass.
Tests
The compiler test suite is now in the repository under tests/ (152 cases, run with tests/run_tests.ps1). Three new cases cover the fixes above; they fail on 1.2.0 and pass on 1.2.1.
Benchmarks
C and C++ are now built with clang on both x86 and x64. The x64 numbers in 1.2.0 used gcc, which made C look slow on lcg. Sources, flags, and the runner are in enderscript-bench.
Windows 32-bit (ms, fastest run):
| Benchmark | EnderScript | C | C++ | Zig |
|---|---|---|---|---|
| hello | 4.2 | 5.2 | 5.4 | 4.6 |
| lcg | 110.7 | 142.4 | 139.5 | 219.2 |
| fizz | 197.6 | 306.9 | 306.2 | 303.7 |
| modchain | 274.8 | 360.6 | 357.3 | 356.3 |
| sieve | 50.5 | 52.9 | 53.1 | 56.4 |
| 20.9 | 95.4 | 102.0 | 23.3 | |
| pipe | 30.9 | 243.3 | 1460.2 | 31.4 |
Windows x64 (ms, fastest run):
| Benchmark | EnderScript | C | C++ | Rust | Zig | Python |
|---|---|---|---|---|---|---|
| hello | 3.2 | 3.9 | 3.9 | 4.3 | 3.5 | 16.8 |
| lcg | 151.9 | 177.5 | 176.1 | 175.0 | 172.9 | 30571.9 |
| fizz | 175.7 | 264.8 | 263.3 | 260.5 | 277.1 | 17061.0 |
| modchain | 235.8 | 388.4 | 384.3 | 393.0 | 416.5 | 12392.2 |
| sieve | 50.7 | 51.7 | 51.2 | 51.2 | 53.2 | 2629.8 |
| 11.3 | 69.4 | 83.4 | 21.6 | 12.0 | 583.4 | |
| pipe | 16.6 | 162.8 | 1081.6 | 34.3 | 20.3 | 352.2 |
Every language produces exactly the same output.
Where EnderScript is still slower
The benchmarks above match loop patterns the compiler has dedicated optimizations for. On ordinary code EnderScript is still 1.3 to 4.5 times slower than C. These three programs were never tuned for (sources in enderscript-bench):
Windows 32-bit (ms, fastest run):
| Benchmark | EnderScript | C | C++ | Zig |
|---|---|---|---|---|
| gcd | 691.3 | 391.0 | 395.3 | 352.5 |
| collatz | 669.2 | 319.3 | 315.5 | 348.3 |
| matrix | 280.3 | 61.9 | 58.8 | 90.8 |
Windows x64 (ms, fastest run):
| Benchmark | EnderScript | C | C++ | Rust | Zig |
|---|---|---|---|---|---|
| gcd | 436.7 | 330.7 | 330.6 | 310.6 | 254.6 |
| collatz | 445.6 | 315.7 | 316.9 | 306.9 | 287.2 |
| matrix | 238.8 | 58.3 | 57.6 | 59.6 | 56.7 |
Improving general code generation is the next step.
EnderScript 1.2.0
First release of EnderScript 1.2.0, the next major version. This release covers Windows x86 (32-bit) and x64 only. ARM64 is coming later: it hasn't been tested on real ARM hardware yet, so it's not included here. Linux is coming later too.
The syntax hasn't changed at all, so existing programs still run as before.
Download
| File | For |
|---|---|
enderscript-1.2.0-windows-x86.zip |
Windows 32-bit |
enderscript-1.2.0-windows-x64.zip |
Windows 64-bit |
Extract it and run ender.exe <file.es>. Nothing to install. Use SHA256SUMS.txt to check that your download isn't corrupted.
What's new
- All Windows platforms now live in one repository:
windows/x86,windows/x64,windows/arm64. It contains only assembly plusbuild.ps1. - x86 was optimized until it beat C, C++, and Zig on every benchmark:
- sieve: array fill uses
rep stosd, the index bounds check runs once up front, and the counting loop uses SSE - modchain: the compiler can now prove a variable is never negative, so division and modulo use cheaper code
- lcg: an
x = x*a + bloop with anifinside now runs 4 iterations at a time without branches - print/pipe: numbers are printed with a two-digit table, and the output and input buffers were enlarged to 256 KB
- sieve: array fill uses
- Fix: input lines longer than 64 KB could be read incorrectly. There is now a line-length check.
Benchmarks
Windows 32-bit (ms):
| Benchmark | EnderScript | C | C++ | Zig |
|---|---|---|---|---|
| hello | 4.4 | 5.4 | 5.7 | 4.6 |
| lcg | 112.3 | 143.7 | 143.1 | 224.8 |
| fizz | 201.6 | 313.4 | 314.6 | 308.2 |
| modchain | 280.2 | 368.8 | 367.6 | 364.6 |
| sieve | 53.4 | 54.0 | 55.2 | 58.0 |
| 23.1 | 100.0 | 107.1 | 24.3 | |
| pipe | 33.2 | 252.5 | 1505.1 | 35.0 |
Windows x64 (ms):
| Benchmark | EnderScript | C | C++ | Rust | Zig | Python |
|---|---|---|---|---|---|---|
| hello | 3.3 | 3.9 | 4.2 | 4.7 | 3.6 | 17.4 |
| lcg | 155.6 | 691.7 | 680.3 | 178.2 | 173.6 | 30928.6 |
| fizz | 186.1 | 577.9 | 579.3 | 264.2 | 278.1 | 16668.5 |
| modchain | 237.1 | 371.9 | 369.0 | 390.2 | 413.4 | 11783.2 |
| sieve | 50.1 | 53.1 | 53.2 | 51.2 | 52.8 | 2551.9 |
| 11.2 | 66.7 | 33.6 | 21.6 | 12.0 | 577.4 | |
| pipe | 15.9 | 167.3 | 94.7 | 33.8 | 21.5 | 363.1 |
Each number is the fastest run. Every language produces exactly the same output.
Tests
- Test suite: 149/149 passed on x86 and x64
- All fuzzers passed, and input fuzzing gave identical output on x86 and x64 in 400/400 cases