Hacker News new | ask | show | jobs
by jxndbdbd 15 days ago
Interesting project! I have not looked to closely at the source so forgive me for asking

- Are you doing a source to source or byte code to source transformation? - How are you beating lua performance, since the naive implementation of a dynamic language would require tons of tables with pointer chasing

1 comments

Thanks!

- clx compiles directly from Lua source code. It has its own parser and C++20 code generator; it does not use Lua bytecode

- The goal isn't necessarily to beat Lua, but some workloads benefit from the optimizations performed by modern C++ compilers.

As for tables, clx doesn't use a naive boxed-object model. Tables have a split array/hash layout: integer keys are stored in a contiguous array, while other keys use an open-addressed hash table. That keeps common accesses cache-friendly and avoids a lot of pointer chasing.

Thanks for the explanation!