Skip to content

C Function calls from JS after faster than JS function calls? #225

Answered by bnoordhuis
ammarahm-ed asked this question in Q&A
Discussion options

You must be logged in to vote

It's not too surprising because quickjs has to perform a fair amount of bookkeeping on JS function entry (and, to a lesser extent, exit.)

Both the C and JS function don't really do anything except return so that bookkeeping turns into significant overhead for the JS function, whereas the C function is probably literally only two or three assembly instructions. If anything, I'm surprised the gap isn't bigger!

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@ammarahm-ed
Comment options

@ammarahm-ed
Comment options

@ammarahm-ed
Comment options

Comment options

You must be logged in to vote
1 reply
@ammarahm-ed
Comment options

Answer selected by saghul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants