Uh oh!
There was an error while loading. Please reload this page.
Priority overload - #1131
Conversation
529ce3e to
a331f96Comparewjakob
commented
Oct 9, 2017
Although I understand the motivation, I'm not in favor of this modification, which further increases the runtime cost and complexity of an already very complex dispatch routine. I think that we ought to make this part of pybind11 shorter and faster, not the other way. |
henryiii
commented
Oct 9, 2017
Does this increase the runtime? All it does is allow someone to attach a function at the beginning of the overload chain instead of the end, but the overload chain is the same length either way. It doesn't even increase the size of the struct, since there's one bit left over for alignment. So in the setup (runtime) phase, it adds one if statement. This functionality seems useful in a more general case, where a user needs to pre-insert a call. But up to you. |
wjakob
commented
Oct 9, 2017
Aha -- I misread the patch in that case. I was assuming that the priority tag was handled in the method dispatch function, but I see now that it is in the part of the code that creates Python function overloads. I've recently heard from users who found that Boost.Python dispatches methods faster than pybind11 (!?!?), which still has me a bit concerned that we are piling on too much stuff. |
wjakob
commented
Oct 9, 2017
One naming suggestion: how about calling it |
henryiii
commented
Oct 10, 2017
I took the name from the original comment from @jagerman, I don't think he meant it to be final. I like Unrelated: Any numbers or profile code for the boost Python comparison? |
jagerman
commented
Oct 10, 2017
|
57e1fe2 to
034e13dComparewjakob
commented
Oct 11, 2017
Unfortunately we don't currently have a good way of tracking performance over time, which is a bit of a concern. It would be nice to have a CI to catch performance regressions similarly to how we catch bugs with Travis and friends. I played around with Unladen Swallow at some point but haven't had enough free clock cycles to turn it into something useful. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jagerman
commented
Oct 29, 2017
I've pushed a commit to your branch that ought to get this working (a86451d). Basically the start of the chain was only being half-updated: it also needed to be updated inside the |
henryiii
commented
Nov 1, 2017
FYI, I'll polish off the tests as soon as I get a chance, hopefully around this weekend. |
henryiii
commented
Apr 4, 2018
@jagerman That was a very long weekend, but it should be ready for review finally! |
jagerman
left a comment
There was a problem hiding this comment.
Two very minor comments, aside from those it looks good to me.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
35a3016 to
1c2f982Compare1c2f982 to
8308930Comparehenryiii
commented
Oct 21, 2018
Could this be useful in 2.3.0? |
a279e67 to
4b1a38aComparehenryiii
commented
Oct 2, 2020
Maybe we could also add a mention in the upgrade guide that |
rwgk
left a comment
There was a problem hiding this comment.
Looks great! I have just some minor naming suggestions.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
YannickJadoul
left a comment
There was a problem hiding this comment.
Should be rather painless, I think, yes :-)
Uh oh!
There was an error while loading. Please reload this page.
4b1a38a to
403a532CompareUh oh!
There was an error while loading. Please reload this page.
rwgk
left a comment
There was a problem hiding this comment.
This PR was included in Google-global testing: no issues found.
wjakob
left a comment
There was a problem hiding this comment.
The implementation looks all good to me, but documentation could be improved IMO.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
wjakob
commented
Oct 5, 2020
(Really sorry that this has been stuck here in 2017. The flurry of recent activity has been wonderful -- thank you for all of your help! @henryiii@YannickJadoul@bstaletic@rwgk@EricCousineau-TRI and @ax3l) |
wjakob
commented
Oct 5, 2020
My vote would also go for I feel less strongly about the following: For consistency, we could also have a |
henryiii
commented
Oct 5, 2020
FWIW, I would be in favor of adding a |
d34a67a to
92268fdCompare92268fd to
dd862c2Compare
Adds
py::prepend()as an optional tag when defining a function, which causes an added function to be prepended to the beginning of the overload chain. This can be used to override a default constructor that was provided earlier, for example. When combined with #1122, this will allow the default string (or the old int) constructors for enums to be replaced by users.No performance penalty, it just prepends instead of appends to the call chain. Provides a possible solution to, and docs for, so closes#2537, so targeting 2.6.0 (related to the original use case, actually :) )
Also adds
get_pointer/set_pointerforpy::capsule.