r/Compilers • • Oct 20 '26

COMPRINLY vs NASM vs C

http://github.com/rhyelt/Comprinly

I benchmarked all three languages with their standard commands and the standard scripts without any made optimizations in the scripts.

The benchmark is Compile, Run, and Size.

Hello, World!:

Language - Compile - Run - Size

C (GCC 13.3) - 35.5 ms - 2.3 ms - 15,960 bytes

NASM 2.16 with LD - 6.4 ms - 1.5 ms - 8,864 bytes

COMPRINLY 1.3.2 - 9.6 ms - 1.5 ms - 274 bytes (Old version was 290 bytes)

Count primes below 300,000:

Language - Compile - Run - Size

C (GCC 13.3) - 38.6 ms - 50.2 ms - 15,960 bytes

NASM 2.16 with LD - 6.6 ms - 48.4 ms - 5,032 bytes

COMPRINLY 1.3.2 - 10.7 ms - 48.4 ms - 361 bytes

You could test Comprinly for this if you doubt the benchmark, I have no testers.

Overall:

Compile Speed - NASM

Run Speed - NASM and Comprinly

Size - Comprinly

You can try Comprinly in the linked repo

0 Upvotes

4 comments sorted by

1

u/[deleted] Oct 21 '26

Are you seriously comparing build time of Hello-World, and its runtime?

This is like 15 loc in assembly, and perhap 4 lines in C.

1

u/Upper-Ad4677 Oct 21 '26

Yeah, it is… I used 16 lines in assembly and 5 lines in C. Its just a simple test against my programming language, no need to be mad.

1

u/[deleted] Oct 21 '26 edited Oct 21 '26

The problem is that the results (timings and sizes, not the output) are not meaningful. Unless you want to establish a baseline set of overheads for an empty program, which is essentially what this is.

FWIW, on my PC, gcc takes 0.2 seconds to compile a 5-line hello.c on Windows (even without stdio.h).

So that's 25 lines per second. gcc is not fast, but it's not really that slow either!

1

u/Upper-Ad4677 Oct 21 '26

Fair enough, but I was just testing how they perform with their standard commands on simple programs. Obviously, it's not some definitive benchmark.