Simple benchmark for terminal output

Related tags

CLI termbench
Overview

TermBench

This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can be built with either MSVC or CLANG, and has no dependencies. There is only one file. Example build commands for MSVC and CLANG are provided in the included build.bat.

Motiviation

Recently, Microsoft officially "deprecated" using anything other than virtual terminal codes for outputing full-color character displays to the terminal. Unfortunately, their actual implementation of virtual terminal codes seems excruciatingly slow, and the result is that a full-screen (~30,000 cell) character update runs at around two frames per second on a modern dev machine - which is absurd.

I made this utility in order to test other alternative terminals to see if they were faster, and/or to hopefully motivate someone at Microsoft to figure out why their terminal code is so excruciatingly slow.

Issues
  • An alternative Arabic translation.

    An alternative Arabic translation.

    The current translation is perfectly grammatical and does carry the full meaning of the original quote. However, it is too literal, akin more to a Google translation than a native one. You wouldn't come across such a sentence in a book or newspaper for instance. The one I'm proposing in the other hand is more like a real-world rendition of the quote. I hope that people with a good grasp on Arabic would also weigh in on this.

    opened by tellela 7
  • termbench: Compiling for Mac M1

    termbench: Compiling for Mac M1

    This PR adds support for M1 Macs. I have extracted the process of obtaining the CPU name into a separate function to make a little bit more clean as the M1 doesn't need the loop. I also omitted the inclusion of cpuid.h in case of M1 as it was throwing a compiler error "This is only for x86". I guess that this has only inline asm for intel cpus.

    Edit: I didn't know if I should open this PR against master or V3 so I went with master. If you want me to change that, feel free to tell me :)

    opened by GeorgeLS 4
  • Manjaro Gnome benchmarks

    Manjaro Gnome benchmarks

    I just wanted to share my benchmark results:

    # gnome-terminal
    CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    VT support: no
    ManyLine: 82.4858s (0.0121gb/s)
    LongLine: 71.3162s (0.0140gb/s)
    FGPerChar: 5.1682s (0.0562gb/s)
    FGBGPerChar: 9.6057s (0.0587gb/s)
    TermMarkV2 Normal: 168.5759s (0.0169gb/s)
    
    # alacritty
    CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    VT support: no
    ManyLine: 24.2993s (0.0412gb/s)
    LongLine: 19.4805s (0.0513gb/s)
    FGPerChar: 3.7274s (0.0779gb/s)
    FGBGPerChar: 8.0369s (0.0702gb/s)
    TermMarkV2 Normal: 55.5441s (0.0514gb/s)
    
    # foot (https://codeberg.org/dnkl/foot)
    CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    VT support: no
    ManyLine: 19.0191s (0.0526gb/s)
    LongLine: 6.5224s (0.1533gb/s)
    FGPerChar: 2.8055s (0.1035gb/s)
    FGBGPerChar: 5.2957s (0.1065gb/s)
    TermMarkV2 Normal: 33.6426s (0.0848gb/s)
    
    # Hyper (https://hyper.is/) - it had some issues with the color output
    CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    VT support: no
    ManyLine: 15.6713s (0.0638gb/s)
    LongLine: 7.8218s (0.1278gb/s)
    FGPerChar: 2.9988s (0.0968gb/s)
    FGBGPerChar: 6.2595s (0.0901gb/s)
    TermMarkV2 Normal: 32.7513s (0.0872gb/s)
    
    opened by publicarray 2
  • Build error on old SDK

    Build error on old SDK

    According to my registry I have version 6.3..9600 (yes double dot) of the sdk.

    So the ENABLE_VIRTUAL_TERMINAL_PROCESSING is not defined, I slapped in this after include windows.h and it worked fine.

    #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
    #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
    #endif
    

    Still slow though...

    opened by IRooc 2
  • RIS at bench-end, use real screen size, and implicit conversion fixes

    RIS at bench-end, use real screen size, and implicit conversion fixes

    Is this something you are interested in?

    other problems i see is that one may not always be interested in having all tests ran but only a select set of tests.

    opened by christianparpart 1
  • Romanian translation for the

    Romanian translation for the "You can wake up..."

    You can wake up the one who is sleeping, but not one who is pretending to sleep.

    Îl poți trezi pe omul care doarme, dar nu și pe cel care se preface că doarme.

    opened by mariusor 1
  • Support

    Support "Apple Silicon" Macs

    This change prints the Apple product name in place of CPU on "Apple Silicon" machines, and "Unknown" when the CPU is completely unknown.

    Having the benchmark run with an unidentified CPU is probably more useful than having it fail to build on a new platform, so #warning is chosen over #error.

    I'm not sure how to pull detailed ARM specs of the CPU, so there's potentially more work here, but this is enough to get things running on M1 machines.

    Tested on a MacBook Air:

    $  ./termbench small
    
    CPU: MacBookAir10,1
    VT support: yes
    Fast pipes: no
    ManyLine: 0.001gb / 0.038s (0.026gb/s)
    LongLine: 0.001gb / 0.029s (0.034gb/s)
    FGPerChar: 0.001gb / 0.045s (0.022gb/s)
    FGBGPerChar: 0.001gb / 0.036s (0.027gb/s)
    Binary: 0.001gb / 0.052s (0.019gb/s)
    TermMarkV3 small: 0.201s (0.024gb/s)
    
    opened by Chris--B 1
  • Add Unicode output at the end

    Add Unicode output at the end

    Add a bunch of VT and Unicode stuff at the end just so you can see along with the benchmark whether they handle RTL, Arabic, Hebrew, blink, inverse video, whatever.

    - Casey

    opened by cmuratori 1
  • Add Croatian translation

    Add Croatian translation

    It does not add many diacritics. I could formulate it in a way that adds more but it be less natural. "onog koji spava" would then be "spavajućeg".

    opened by Dautor 0
  • Fix gibibyte symbol

    Fix gibibyte symbol

    1. Avoid bit/byte confusion IEC 60027 specifies that the symbol for binary digit should be 'bit', and this should be used in all multiples, such as 'kbit', for kilobit. However, the lower-case letter 'b' is widely used as well and was recommended by the IEEE 1541 Standard (2002).

    2. Also avoid "giga" confusion. Giga according to SI is abbreviated as uppercase G and means 10^6. Termbench uses binary units (1024^n) therefore this should be written as Gi (gibi)

    opened by Self-Perfection 0
  • Build fails on Win11 + VS2022

    Build fails on Win11 + VS2022

    Running build.bat there are 2 warning and 2 errors. Sample error:

    termbench.cpp:286:43: error: constant expression evaluates to 17179869184 which cannot be narrowed to type 'size_t' (aka 'unsigned int') [-Wc++11-narrowing]
        {"ManyLine", ManyLine, {1*Meg, 1*Gig, 16*Gig}},
                                              ^~~~~~
    termbench.cpp:286:43: note: insert an explicit cast to silence this issue
        {"ManyLine", ManyLine, {1*Meg, 1*Gig, 16*Gig}},
                                              ^~~~~~
                                              static_cast<size_t>( )
    

    How do you build termbench on Win11 + VS2022? Thx.

    opened by elsaco 3
Releases(V1)
Owner
Casey Muratori
Programmer at Molly Rocket on 1935 and host of Handmade Hero
Casey Muratori
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

jhomas tefferson 0 Nov 18, 2021
a simple to use linux terminal

a simple to use linux terminal

notaweeb 7 Feb 17, 2022
Simple Unix Terminal Football Manager-like game.

Superleage 2020/2021 It is a "work in progress" simple game based on some mechanics of Football Manager. The game is in a very early stage of Developm

sewe2000 2 Oct 14, 2021
My customized version of the Simple Terminal (st) by suckless.org

st This is my customized version of Simple Terminal (st) by suckless.org . There are only three patches applied to this software, alpha, scrollback, a

Cipher7 1 Oct 6, 2021
Luke's build of st - the simple (suckless) terminal

Luke's build of st - the simple (suckless) terminal The suckless terminal (st) with some additional features that make it literally the best terminal

Brisk Bear Limited 1 Jan 4, 2022
EAMain provides a multi-platform entry point used for platforms that don't support console output, return codes and command-line arguments.

EAMain provides a multi-platform entry point used for platforms that don't support console output, return codes and command-line arguments.

Electronic Arts 30 May 17, 2022
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Jupyter Xeus 208 Jun 30, 2022
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Arthur Sonzogni 3.2k Jun 23, 2022
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Cacahuète Sans Sel 18 Apr 27, 2022
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

null 42 Feb 28, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

romes 164 Jun 22, 2022
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

Tom Szilagyi 212 Jun 22, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Microsoft 83.8k Jun 27, 2022
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Mischievous Meerkat 14.3k Jun 28, 2022
Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph Monitor for Chia Harvesting Introduction The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 2

Bram Stolk 219 Jun 3, 2022
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Arthur Sonzogni 61 Jun 26, 2022
tinytetris - 80x23 terminal tetris

tinytetris - 80x23 terminal tetris

Conor Taylor 1.8k Jul 2, 2022
Contour - A modern C++ Terminal Emulator

contour is a modern terminal emulator, for everyday use. It is aiming for power users with a modern feature mindset.

Contour Terminal Emulator 873 Jun 26, 2022
A C, C++ and Rust library to draw graphics with pixels in the terminal

A library to draw graphics with pixels in the terminal Who needs a GUI when you have a terminal ? Building To generate libpluto.a, run: $ make To ins

null 67 Jun 15, 2022