Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Clang doesn't know about the static code, so it can't do the optimizations this does.

You could probably do the same thing with some hacky C++ code gen and templates, but I'm not sure clang et al would be able to optimize them.




In the limit, that's called Copy and Patch!


Isn't copy and patch just jitter: new fangled kids' version?


As far as I can tell from the jitter docs, no; the big thing about copy and patch is that you can piggy back on the existing C compiler and whatever backends it already supports.


> piggy back on the existing C compiler and whatever backends it already supports

that is the whole point of jitter


Does jitter compile C at run-time or just stitch it together? (EDIT: looks like stitch at run-time)

The other thing C&P does is allow for a library of stencils and stitch them together intelligently depending on where arguments are coming from, where the return should go, where the flow of control should go next, etc

EDIT: So I guess they look fairly similar, huh


yup, jitter does that too; e.g. https://ageinghacker.net/talks/jitter-slides--saiu--bts-2022... page 23 and 35

fwiw i thought this was a stupid, hacky, pointless approach when it was called jitter and i still think it's a stupid, hacky, pointless approach when it's called copy-and-patch ;)

but still like to see credit where it's due


I wonder if they're truly unaware of one another and developed in parallel or not. Hmmm




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: