Losing performance when adding function to a package?

Hey guys!

Basically I have a function which I use to read data. If I use this function directly inside of Julia ie. by compiling it as a function directly, using BenchmarkTools it runs in about 350 ms, but if I put it into a package instead and then load this package, it takes 150 ms longer, so 500 ms.

This of course is not a huge difference, but still in theory about 1/3 performance loss. Could someone explain to me why this would happen?

Kind regards

Could you give a self-contained example of a function demonstrating this property please?

2 Likes

Will try to do so later today, seems like it is not expected behaviour :slight_smile:

Kind regards

@non-Jedi, I uploaded my package to Github and then downloaded it from there and now I don’t experience any performance loss. Maybe some other error has occured, which I was not aware of at the time.

Regards

It’s hard to say anything without an example. But in general, I would not expect to see any change in performance when a function is moved into a module. If you do find such a case and can reproduce it, then you can certainly post it here: it might indicate a bug in Julia or some other mistake that would be worth correcting.

1 Like

If I come across the problem again I will let you guys on discourse now. Currently if any bug would exist it would be due to offline compilation of a package using “activate .” in pkg mode. That is the only difference as far as I can tell from using “add Githublink”

Kind regards