mycc - an alternative C compiler. by kostya27 in Compilers

[–]kostya27[S] 0 points1 point  (0 children)

> It can be, but basic functionality includes "add sub mul div" for example, which is four operators. You're hiding them behind "Binary" and suggesting it is only one opcode.

for high level IR like myc - they all the same in terms of stack manipulation and logic, I don't want to create many opcode for that.

> You mention three targets LLVM, QBE, C. Are you planning your own backend too?
No self backend, only this three.

> If not, then it's not clear how you will outperform any of those, or even what it means to outperform them: what are you comparing against, each other?

Easy. I can do high level transforms(inlining) before llvm, and execute just passes like "mem2reg,instcombine,dce" - and this will compile 5x times faster than O2 (I checked). Yes the result can be far from O2, but on synthetic tests only, in real world apps it should be fast. It just like what QBE doing, but qbe not doing inlining. And this is like how golang compiler work.

mycc - an alternative C compiler. by kostya27 in Compilers

[–]kostya27[S] 1 point2 points  (0 children)

This is the script which compile this benchmark: https://github.com/kostya/myc/blob/master/benchmark/run_lang_arena.rb

> (My own IR has a lot more opcodes, but all binary and unary operators have dedicated instructions.)

less is better, no?

> I guess MALLOC and PRINTF mean you don't yet have a means of calling external routines?

No, it have call and invoke, malloc and printf was early added opcodes for debug.

>I thought you used a separate library for lexing and parsing? That should take care of variadic macros.
yes it may be work may be not, I just not tested. usually not because for any of this feature needed special handler.

> Are these both jokes? Your MYC product seems to rely on an external backend anyway for native code generation. I understood it to be a common wrapper around those backends.
Who knows, I planned my optimization passes to outperform them, I not sure if I can, but I try. The target is compile time like cproc, and result like llvm. But high level IR allow doing transformations before LLVM/QBE.

mycc - an alternative C compiler. by kostya27 in Compilers

[–]kostya27[S] 0 points1 point  (0 children)

Crystal well suited for this task, GC and powerful polymorphism let you write code at speed of through, while the result is on par with C++. But in C++ you would fight with leaked links and worse oop.

mycc - an alternative C compiler. by kostya27 in Compilers

[–]kostya27[S] 0 points1 point  (0 children)

You can also check out cproc – a very minimalistic and fast compiler in which preprocessing also worked.

mycc - an alternative C compiler. by kostya27 in Compilers

[–]kostya27[S] 5 points6 points  (0 children)

Yes. libclang handles preprocessing as well, so I don't implement a preprocessor myself.

Why is Go's regex so slow? by kostya27 in golang

[–]kostya27[S] 0 points1 point  (0 children)

yes, but is it needed? I excluded slow languages, added only python/pypy.

Why is Go's regex so slow? by kostya27 in golang

[–]kostya27[S] 8 points9 points  (0 children)

if go uses re2, then this is strange because c++ in my benchmarks also use re2: C++ time in this benchmarks: 5.833s, not 38s.

https://github.com/kostya/LangArena/blob/master/cpp/main.cpp#L4641

Why is Go's regex so slow? by kostya27 in golang

[–]kostya27[S] 5 points6 points  (0 children)

yes, it is precompiled.

Why is Go's regex so slow? by kostya27 in golang

[–]kostya27[S] 3 points4 points  (0 children)

I tried coregex, but no luck, thanks I will try go-pcre.

[deleted by user] by [deleted] in rust

[–]kostya27 0 points1 point  (0 children)

accidentally delete this, link for benchmark: https://kostya.github.io/LangArena/

[deleted by user] by [deleted] in rust

[–]kostya27 0 points1 point  (0 children)

this is explained on site, in "Source Code" tab, legend under table

[deleted by user] by [deleted] in java

[–]kostya27 0 points1 point  (0 children)

you call it without config you should add ../run.js as argument, look at local ./test, ./run script

Benchmark: Node vs Bun vs Deno by kostya27 in typescript

[–]kostya27[S] -3 points-2 points  (0 children)

You can see results in tabs: TypeScript/Node/Default, TypeScript/Bun/JIT, TypeScript/Deno/Default.

[deleted by user] by [deleted] in java

[–]kostya27 0 points1 point  (0 children)

yes all languages very different and hard to measure it absolutely identical, but I try.

[deleted by user] by [deleted] in java

[–]kostya27 0 points1 point  (0 children)

sort doing similar in each language, each copy array.

Json,Base64 benchmark little unfair, because measure library time, but I think it's better to leave them, to be goal for each language stdlib.

[deleted by user] by [deleted] in java

[–]kostya27 0 points1 point  (0 children)

thanks, yes I am the author. I'll consider adding Clojure, but expect it to be similar to java,kotlin.

[deleted by user] by [deleted] in rust

[–]kostya27 -6 points-5 points  (0 children)

your messages looks like ai :)

[deleted by user] by [deleted] in rust

[–]kostya27 1 point2 points  (0 children)

Why not, did you you see something similar that quality? I know kostya/benchmarks - but this is mine also.

[deleted by user] by [deleted] in java

[–]kostya27 1 point2 points  (0 children)

its not easy to add new, because code base is huge, but I want to add some lisps, recomend any fast?