5 ms·
This is interesting. How long does GCC take? Have you tried TCC?
by pinum 10y ago
This is interesting. How long does GCC take? Have you tried TCC?
- archimedespi 10y agotcc is blazingly fast, at least last time i used it. it's honestly fast enough that you could probably use it as an c interpreter
- Hydraulix989 10y agoAny technical reasons in particular? I'm curious. How many passes is it doing? I suspect they aren't doing much optimization then? Maybe they patch in differences in the ASTs at the IR level and work from there?
- smitherfield 10y agoMy understanding is TCC does little to no optimization; it's intended to be used for bootstrapping.
- buserror 10y agoI do use it as interpreter on embedded boards! Preprocess/trim the headers you need, and add #!/bin/tcc -run at the top of your .C file, add a +x to it and it'll run just fine! I love tcc, in fact I added a firmware instruction translator to 'JIT' AVR code to simavr a few weeks ago. Takes a AVR binary, translates it to C, and compiles it on the fly with libtcc to run it :-) https://github.com/buserror/simavr/tree/jit-wip https://github.com/buserror/simavr/tree/jit-wip
- juliangoldsmith 10y ago>I love tcc, in fact I added a firmware instruction translator to 'JIT' AVR code to simavr a few weeks ago. Takes a AVR binary, translates it to C, and compiles it on the fly with libtcc to run it :-) That is unholy, and glorious.
- buserror 10y agoAhah, thanks for that -- I thought it was pretty clever, but it's hard to explain why to someone :-) If you look closer, you can see I've actually repurposed the main interpreter core, and uses a GNU awk (of all thing) to extract each opcode emulation 'meat', converts it to a string to and that string is used by the translator to generate the C for tcc...
- badsectoracula 10y agoGCC 6.2.0 under MSYS2 takes 6.302s for a full debug build and 10.499s for a full optimized build. With make -j8 this is down to 1.997s for a full debug build and 6.942s for a full optimized build. I haven't tried TCC, i think i tried at the past but it was missing some libs.