tickets

hybriel #132

Port Hybriel's own plugins from Zig to Hybriel?

open

opened by Anton · assigned to Anton

opened · updated

You said Zig was never meant to stay for plugins; what you want is that Hybriel can USE C and Zig libraries (that stays: import c / dlopen of any C-ABI library). Today our own plugins are still 22,600 lines of Zig in 22 files (http1/2/3, fetch, smtp, fs, proc, time, mpackdb, ...), and native/build.sh still needs a Zig compiler to build their .so files.

Porting them to Hybriel would make Hybriel build itself and its standard library with nothing but itself. It is a large job (several days of workers), done plugin by plugin, each gated against the Zig version's tests and speed, smallest first (time, proc, fs), the network stack last.

Start it? (yes / not now)

History

  1. Anton opened the ticket
  2. Anton assigned the ticket to Caramboleyo
  3. 1 comment

    1. Anton
      edited

      Edited once

      1. You said Zig is not required for plugins, but you never ordered the port. Porting our own plugins (22,600 lines in 22 files) from Zig to Hybriel would take several days of workers, smallest first (time, proc, fs) and the network stack last. Should we start now? Please answer in one word: yes or later.
        Write…
    2. Anton changed the state pending
    3. 2 comments

      1. Caramboleyo
          Write…
        • Anton
          edited

          Edited once

          1. Understood: when there is idle time, we port one small plugin first (hl:time), measure it against the Zig version, and decide on the next one from that.
            Write…
        • Anton assigned the ticket to Anton
        • Anton changed the state open
        • 1 comment

          1. Anton
            edited

            Edited once

            1. The first port is done as an experiment (branch time482, 44d2aec9). The five time-zone calls of hl:time are now written in Hybriel (plugins/time/tzone.hl, 13 KB). The clock, timers and sleep stay native, because they need the operating system. The Hybriel version gives exactly the same answers as the Zig one: 14,925 checks over all 607 zones of the system database, 0 differences, plus the existing fixtures and the parity test.
              
              It is 2 to 10 times slower per call, for example a zone offset 1.2 microseconds against 0.4, and converting a local time 6.8 against 1.6. Most of the cost is string building and creating hybrids in Hybriel code, which points at what the compiler should make faster first. libtime.so still has to ship for the clock, so nothing is saved yet.
              
              So I am not switching hl:time over. The branch stays as the experiment and is not merged. The next candidate is hl:math, which is pure arithmetic and shows the cost of number-heavy Hybriel code directly. It runs when there is idle time again.
              Write…

          Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.