Closed rofl0r closed 4 years ago
Thanks. I'll look into it.
I've built cproc
using ./configure
and make
.
But when I build
int main() { return 0; }
as
./cproc main.c -o main
it errros as
cproc: codegen: spawn "qbe": No such file or directory
cproc: compile: process signaled: Terminated
cproc: preprocess: process signaled: Terminated
Are you saying I should benchmark generation to QBE-IR using cproc-qbe
main.c -o main.qbe instead?
you need to run "make qbe" and then put the produced qbe binary in qbe/ into your PATH, then run cproc
cproc executable runs qbe as a subprocess (sorry about that)
That seems awkward. It would be nice if you add an install target to the Makefile
that installs both cproc and qbe using an install PREFIX
variable called via something like
make PREFIX=~/local/bin install-all
.
cproc isnt my project, but i contacted its author regarding this. thanks for your patience!
Note that D performs a set of extra semantic passes for instance dead code elimination. So you must take into account all those passes or disable them to get a fair comparison.
of course: qbe does that too and a lot more. according to its website it's designed to achieve 70% of llvm performance while staying reasonably simple. but since your benchmark focuses on compilation speed, this is where cproc/qbe shine the most: even just compiling cproc itself takes less than one second on my system.
Nice. I'm gonna have look at QBE.
of course: qbe does that too and a lot more.
Note quite the same. D-compilers has dead-code elimination in the frontend that can diagnose to the user mistakes in the data flow.
you need to run "make qbe" and then put the produced qbe binary in qbe/ into your PATH, then run cproc
cproc executable runs qbe as a subprocess (sorry about that)
I suppose you mean put the qbe/obj/qbe
into the path.
Ok, I build qbe
aswell and put into the path.
When I build
int main(void) { return 0; }
as
cproc f.c -o f
it fails during linking as
//usr/lib/x86_64-linux-gnu/crt1.o:function _start: error: undefined reference to 'main'
cproc: link: process 402367 exited with status 1
Is there a flag to to perform syntax only like -fsyntax-only
in GCC?
Thanks for taking a look at cproc!
I'm not sure what's going wrong during linking. Could you provide your system details, and also the output of cproc -v f.c -o f
?
according to its website it's designed to achieve 70% of llvm performance while staying reasonably simple
I think this is more of an aspirational goal, I am not exactly sure how close it is to meeting that goal.
Is there a flag to to perform syntax only like -fsyntax-only in GCC?
Not currently, no.
Thinking about -fsyntax-only, I think you could get part of the way there using -emit-qbe -o /dev/null
. That would still generate QBE IL, but skip running qbe
itself.
Thinking about -fsyntax-only, I think you could get part of the way there using
-emit-qbe -o /dev/null
. That would still generate QBE IL, but skip runningqbe
itself.
Seems like a good idea. Hang on. I'll update ./benchmark
.
Update: I've updated now. It runs both a compile to machine code and an emit of qbe.
Update: I've updated now. It runs both a compile to machine code and an emit of qbe.
cool! looking forward to see cproc results in README.md
cool! looking forward to see cproc results in README.md
However cproc
hangs (enters an infinte loop?) for
./benchmark --languages=C --function-count=20 --function-depth=46 --run-count=1
but not for
./benchmark --languages=C --function-count=20 --function-depth=45 --run-count=1
Happens both with and without the -emit-qbe
flag.
So I can't get any interesting benchmarks.
I'm unable to reproduce the hang on my system. I will try on ubuntu 20.04, since that is what the install script mentions.
I'm unable to reproduce the hang on my system. I will try on ubuntu 20.04, since that is what the install script mentions.
Strange.
Yes, I'm sitting on Ubuntu 20.04.
Hangs for
./benchmark --languages=C --function-count=21 --function-depth=45 --run-count=1
aswell.
Hmm... I don't seem to be able to reproduce on Ubuntu 20.04 either: https://builds.sr.ht/~mcf/job/307438
If it's not too much trouble, could you use gdb -p to attach to the hung process and get a backtrace?
I had a dirty checkout. Things work now. Sorry for the wait. I'll update the numbers soon.
One thing. cproc
forgets to set executable permissions on outputted executable on Linux.
One thing.
cproc
forgets to set executable permissions on outputted executable on Linux.
cproc
just calls the system linker, which should be setting the appropriate executable permissions. I tested lld and GNU ld, and both create a binary with the executable bit set, so I'm not sure why it isn't getting set for you.
thanks, closing this now as https://github.com/nordlow/compiler-benchmark/commit/7f64bbb41a9b32948e608dade4b15b9dabbcb6cb has been committed.
https://github.com/michaelforney/cproc
should be several times faster than GCC. (of course, if your goal is to make DMD look good, then you probably don't want to add this :-)