question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What can we do to make this fast? At the moment, calling j.sin is 10x slower than math.sin or numpy.sin.

I’m guessing that this is due to type inference issues with the PyCall.jl callback. Is there a way we could provide annotations or hints for individual functions?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
simonbyrnecommented, Nov 14, 2017

My (possibly quixotic) purpose was thinking about how we can make Julia an easy-to-use replacement for C for writing Python backend code. Where is the overhead, and what could we do to make it slimmer?

2reactions
stevengjcommented, Nov 14, 2017

@simonbyrne, but users normally only write Python backend code in C or Cython or whatever for big, expensive functions. That’s why everything in NumPy is vectorized, after all. And for big, expensive function, the function-call overhead shouldn’t matter.

Part of the overhead comes in converting the argument to a Julia type. Since PyCall does not know what kind of Python object you are passing, it has to convert(PyAny, args)... on the tuple of arguments. This, in turn, needs to check what Julia type it should try to convert to. The way this is done is a naive list of if statements right now … it could be improved a lot if we used e.g. some kind of hash table to memoize the results based on the PyObject_Type.

Of course, something like sin could be made faster (but much less flexible) if we only check for one or two possible types. And you could avoid the dynamic dispatch on the Julia side too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance Definition & Meaning - Merriam-Webster
1 · the execution of an action · something accomplished : deed, feat ; 3 · the action of representing a character in...
Read more >
Performance Bicycle - Your Next Best Ride
Shop road, mountain & gravel bikes. Huge selection of parts, components & clothing from Specialized, Shimano & more!
Read more >
Performance - Wikipedia
A performance is an act of staging or presenting a play, concert, or other form of entertainment. It is also defined as the...
Read more >
86 Synonyms & Antonyms for PERFORMANCE - Thesaurus.com
Find 86 ways to say PERFORMANCE, along with antonyms, related words, and example sentences at Thesaurus.com, the world's most trusted free thesaurus.
Read more >
Performance Definition & Meaning - Dictionary.com
performance · a musical, dramatic, or other entertainment presented before an audience. · the act of performing a ceremony, play, piece of music,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found