Hello,  Bart Janssens. I have a question.

If eventually all things compile down to machine code, why those callings 
will have overhead? Why can't the compiler glue C part and julia part 
seamlessly at machine code level?

Another thing I am not sure is that, when we embed code like "jl_eval_string" 
*into C and compile it to a exe*. When running this exe, will it call julia 
engine to evaluate it(this should have huge overhead) or will all be done 
directly at machine code level(no overhead)?

Sorry if my question is nonsense, I am from physics background, just 
curious about the internal and care much about performance.

On Saturday, September 3, 2016 at 6:56:26 PM UTC+8, Bart Janssens wrote:
>
> Hi,
>
> I'd say the better option in terms of performance depends on which path 
> allows you to limit the number of calls into the other language, since 
> there will often be some overhead in calling Julia from C++ or vice versa, 
> even if it's just because things are less transparent to the compiler.
>
> When calling a Julia function from C++, I think you always need to box the 
> arguments, which may be slower than calling C++ from Julia. Also remember 
> to cache the pointer to the Julia function, to avoid the name lookup on 
> every call.
>
> To call C++ functions from Julia, you can also use my CxxWrap package, 
> which allows you to write the Julia interface as a C++ library:
> https://github.com/barche/CxxWrap.jl
>
> Cheers,
>
> Bart
>
> On Sat, Sep 3, 2016 at 2:51 AM K leo <cnbi...@gmail.com <javascript:>> 
> wrote:
>
>> While the majority of my analytics are in Julia, I will need to use an 
>> external event handling API which is implemented in C++.  It looks that I 
>> have two options: 1) write the main code in C++ with the API and call Julia 
>> function for analytics; 2) write the main code also in Julia that work 
>> seamlessly with my analytics and call the C++ API for events.
>>
>> Which would be the better path in terms of ease of coding and performance?
>>
>

Reply via email to