When is libjit really worth it?

I compiled and tried to profile the first tutorial in libjit (mul_add): - https://www.gnu.org/software/libjit/doc/libjit_3.html#SEC6

However, when compared to its own compiled code, it works about 1000 times slower. When profiling with a grinding call, some of the hot spots that appear are: -

jit_apply (17.5%) jit_apply_builder_add_arguments(14.25%) jit_type_normalize (9%) jit_backtrace_push (7%) jit_exception_clear_last (6.5%) jit_thread_get_control (6.5%) jit_type_get_param (5%) and so on and so forth 

My question is: am I doing something wrong here? Also, is this a fixed cost that always occurs when you call the libjit function, or is there some way to get rid of this cost?

Also, if it is a fixed cost, does this mean that there is a certain minimum size for the compiled function, after which using libjit is actually "worth it"?

+4
source share
1 answer

So, I got a response from someone from the libjit mailing list. Apparently using jit_function_to_closure creates a C closure for the jit_function_t object, which can then be called natively from your code.

NTN

+4
source

Source: https://habr.com/ru/post/1502643/


All Articles