benchy

Simple benchmarking to time your code.

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install benchy
choosenim install benchy
git clone https://github.com/treeform/benchy

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
benchy - - - - - - -

Source

Repository https://github.com/treeform/benchy
Homepage https://github.com/treeform/benchy
Documentation View Documentation
Registry Source nimble_official

README

Benchy

  • atlas use benchy
  • nimble install benchy

Github Actions

API reference

This library has no dependencies other than the Nim standard library.

About

Simple benchmarking to time your code. Just put your code in a timeIt block. Don't forgot to run with -d:release.

import benchy, std/os, std/random

timeIt "sleep 1ms":
  sleep(1)

timeIt "sleep 200ms":
  sleep(200)

timeIt "sleep random":
  sleep(rand(0 .. 150))

timeIt "number counter":
  var s = 0
  for i in 0 .. 1_000_000:
    s += s

timeIt "string append":
  var s = "?"
  for i in 0 .. 26:
    s.add(s)

It will run the timeIt block at least 10 times but possibly more to figure out the standard deviation. It will keep running it until things look like they stabilized. It will stop after 60s though.

name ............................... min time      avg time    std dv   runs
sleep 1ms .......................... 1.016 ms      1.993 ms    ±0.032  x1000
sleep 200ms ...................... 200.403 ms    200.463 ms    ±0.022    x25
sleep random ....................... 5.959 ms     75.490 ms   ±44.856    x67
number counter ..................... 2.680 ms      2.747 ms    ±0.052  x1000
string append ..................... 36.322 ms     37.796 ms    ±1.771   x127