Live data from Hacker News

I wrote an LLVM-powered trace-based JIT for Brainfuck

github.com

41–50 of 56 posts

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#41
post #8
post #2

I don't know... "neat hack", but it seems there is so much out there that could actually have some kind of practical application that it's a bit of a waste to work on "silly" projects. I love to hack on things that don't have any immediately evident business model or real world application, but I think purposefully working on something that never will is perhaps a bit unfortunate. Yeah, he learned something for sure,…

I'm assuming you've been downvoted because slightly more than 50% of HNers think of this project as an artistic/fun project. But the fact is, even a purely artistic/fun project will have some creativity or originality in it. I would consider a toy language or Brainf__k written for the first time as artistic. But this project is just a JIT for Brainf__k, there's no creativity in it, and all it did was give the author…

As someone interested in compiler technology, I was happy to see a simple example of a tracing JIT in LLVM. See: http://lambda-the-ultimate.org/node/3851

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#42

Hey folks, I'm the actual author of this. I actually work on LLVM-proper during my day job. This was just a fun exercise to demonstrate that it was possible. I also have plans to write a tutorial based on it.

Great, looks good!

please cover the blog-post also from an LLVM-n00bie perspective., with appropriate code references whereever possible.

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#44

Hey folks, I'm the actual author of this. I actually work on LLVM-proper during my day job. This was just a fun exercise to demonstrate that it was possible. I also have plans to write a tutorial based on it.

Also an example of how to implement a direct-threaded interpreter. Some performance data from a Brainfuck mandelbrot benchmark. Interpreter: 37.787s Tracing JIT: 11.716s Static Compiler: 2.402s The tracing JIT loses out to the static compiler largely because there's no dynamic dispatch in Brainfuck for the tracer to optimize out. There's probably some performance to be recovered by tuning the tracer thresholds and mi…

Thanks for writing this -- it's awesome to see JIT principles boiled down to the point where you can easily understand the whole system. Please let us know if you publish the tutorial; I'd love to see more detail on the JIT. In particular, it would be the perfect template to demonstrate feedback-directed optimization opportunities and to measure the overhead of tracing; it would be incredibly interesting to see what has to be done to make the JIT outperform the AOT compiler.

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#46
post #37
post #28

Earlier quoted context omitted.

> You assume that a person cannot gain something by simply learning something that has no practical purpose Actually, what I wrote , if you'd bother to read it, is: "Yeah, he learned something for sure, but that's pretty much all it can be." so don't put words into my mouth. The point boils down to this: * It'll probably never become big. * That doesn't really matter, it's mostly for learning and for fun. * But even…

The effort you've expended to debate this will soon meet & then exceed the effort that went into the tracing JIT in question. When you reach that point, you'll have some soul searching to do.

You'd be annoyed too if people continued to misconstrue what you were saying in order to attack a strawman.

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#47

Is anyone else oddly inspired to make an OCaml to Brainf k translator just to build a staggeringly awesome rube goldberg machine?

I can not find it, but I have seen a C to brainfuck compiler. Don't ask.

Here's the best reference page for the project:

http://esolangs.org/wiki/C2BF

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#48
post #44

Earlier quoted context omitted.

Also an example of how to implement a direct-threaded interpreter. Some performance data from a Brainfuck mandelbrot benchmark. Interpreter: 37.787s Tracing JIT: 11.716s Static Compiler: 2.402s The tracing JIT loses out to the static compiler largely because there's no dynamic dispatch in Brainfuck for the tracer to optimize out. There's probably some performance to be recovered by tuning the tracer thresholds and mi…

Thanks for writing this -- it's awesome to see JIT principles boiled down to the point where you can easily understand the whole system. Please let us know if you publish the tutorial; I'd love to see more detail on the JIT. In particular, it would be the perfect template to demonstrate feedback-directed optimization opportunities and to measure the overhead of tracing; it would be incredibly interesting to see what…

The tracing overheads are pretty huge. Running with tracing but without compilation takes 107s.

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#49
post #44

Earlier quoted context omitted.

Thanks for writing this -- it's awesome to see JIT principles boiled down to the point where you can easily understand the whole system. Please let us know if you publish the tutorial; I'd love to see more detail on the JIT. In particular, it would be the perfect template to demonstrate feedback-directed optimization opportunities and to measure the overhead of tracing; it would be incredibly interesting to see what…

The tracing overheads are pretty huge. Running with tracing but without compilation takes 107s.

Hefty! As an exercise, any sense in inlining the tracing into compiled code? That way you sacrifice the startup time benefits of the JIT (by AOT compiling at start) but still retain trace specialization.

Re: I wrote an LLVM-powered trace-based JIT for Brainfuck

#50
post #27

Earlier quoted context omitted.

You're assuming that every thing that people work on actually needs the potential to become "big". What about the people that study klingon? Or Esperanto? Or Elvish? You assume that a person cannot gain something by simply learning something that has no practical purpose. This isn't the case. By working on BF, someone might make some neuron connections that help them with logical thought with other projects, by break…

Then how about giving an example of somebody who had some benefit of learning Klingon, not related to Klingon as is?

The Klingon Dictionary is very good at explaining grammatical concepts. It made me interested in how language worked. After reading it I was able to understand a French grammar book and go from getting an E in my French GCSE mock exam to a B in the final a couple of months later. I went on to get a degree in French (which I never used but that's beside the point).
Post reply on HN