Lightweight HailoRT bindings in Nim – simple, fast inference without Python or CMake

Hi,

I’ve been working with HailoRT and felt that:

  • Python bindings are convenient but sometimes too heavy
  • C++ works but build setup (CMake, etc.) can get painful
  • Simple inference requires quite a bit of boilerplate

So I built a minimal Nim binding + high-level Detector API.

Example:

import hailort_nim

let det = Detector.open(“model.hef”).get
let res = det.detectNmsByClass(input).get

for d in res:
  echo d.classId, " ", d.score

It uses Futhark to generate bindings from the C API, so no manual wrapping.
Tested with YOLOv11s HEF models, including NMS parsing.

Repo: GitHub - centurysys/hailort_nim: Minimal and fast Nim bindings for HailoRT with a simple Detector API · GitHub

Performance

Tested on AM67A (Cortex-A53 1.4GHz), single inference:

Python:

real    1.592s
user    1.389s
sys     0.361s

Nim:

real    0.465s
user    0.075s
sys     0.308s

In this setup, Python spends most time in user-space processing,
while Nim is mostly bound by device I/O.

(~3x faster in this simple test)
Would love feedback, especially from people who tried Python/C++ approaches.