HN Hall of Fame Weekly email

Comparing the C FFI overhead in various programming languages

github.com Software & code Software projects Software engineering Candidate
Screenshot of github.com captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 4 calendar years, with breakout response in 2 of them.

submissions
4
submitters
4
observed span
2018–2025
peak thread · 95 comments
141 pts
latest 20+ return · 2022-05-14
124 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

For those wondering why luajit is faster than C/C++/Rust, that's probably because it does direct calls to the function, while C/C++/Rust go through the PLT (procedure linkage table). I don't have luajit to validate this, but changing the C test to dlsym() the symbol first and use that in the loop instead makes the test take 727ms instead of 896ms when going through the PLT on my machine. Edit: confirmed after installing luajit, got the same time as the modified…

Another major caveat to this benchmark is it doesn't include any significant marshalling costs. For example, passing strings or arrays from Java to C is much, much slower than passing a single integer. Same is going to be true for a lot (all?) of the GC'd languages, and especially true for strings when the language isn't utf8 natively (as in, even though Java can store in utf8 internally, it doesn't expose that publicly so JNI doesn't benefit)

(2021)

rurban·5-point thread·

I really think this exemplifies the reason why Lua is so useful.

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
272

reference only — not used in Hall rules or ranking

Total comments
181

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2018-05-26Comparing the C FFI overhead in various programming languagesFirst breakout · Best threadbased214183
2022-05-14Comparing the C FFI overhead on various languagesLatest 20+ point returngenerichuman12495
2024-07-04Comparing the C FFI overhead in various programming languages (2021)nequo52
2025-09-19FFI Overheadsteve-chavez21