Pregunta

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, on comparing it with native compiled code it runs approximately 1000x slower. On profiling with call grind, some of the hotspots that show up 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 constant cost that is always incurred when calling a libjit function or is there some way to get rid of this cost?

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

¿Fue útil?

Solución

So I got a reply from someone on 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.

HTH

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top