<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>glandium</author><text>For those wondering why luajit is faster than C&amp;#x2F;C++&amp;#x2F;Rust, that&amp;#x27;s probably because it does direct calls to the function, while C&amp;#x2F;C++&amp;#x2F;Rust go through the PLT (procedure linkage table).&lt;p&gt;I don&amp;#x27;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.&lt;p&gt;Edit: confirmed after installing luajit, got the same time as the modified C test.</text><parent_chain></parent_chain></comment><story><title>Comparing the C FFI overhead in various programming languages</title><url>https://github.com/dyu/ffi-overhead</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>munificent</author><text>Because Wren&amp;#x27;s a bytecode interpreted dynamic language much of the overall time is probably spent just executing the surrounding benchmark code. I.e. in:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    FFI.start()
    while (x &amp;lt; count) {
        x = FFI.plusone(x)
    }
    FFI.stop()
&lt;/code&gt;&lt;/pre&gt;
It probably spends most of the total elapsed time on:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    FFI.start()
    while (x &amp;lt; count) {
        x = ...
    }
    FFI.stop()
&lt;/code&gt;&lt;/pre&gt;
It would be worth running a similar benchmark but with just the FFI part removed and then subtract that from the time. (And do the same thing for the other languages too, of course.)</text><parent_chain></parent_chain></comment><story><title>Comparing the C FFI overhead in various programming languages</title><url>https://github.com/dyu/ffi-overhead</url></story>