-
Notifications
You must be signed in to change notification settings - Fork 374
avoid Core.Box in the package
#3520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I used JuliaLang/julia#60478 to find all the `Core.Box` instances in the package and then fix them.
| extrude = false | ||
|
|
||
| firstrow = first | ||
| wrapped_first = nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this assignment needed? (we make sure not to access wrapped_first if extrude is false)
| wrapped_first = nothing | ||
| lgd = length(gd) | ||
| if first isa AbstractDataFrame | ||
| if firstrow isa AbstractDataFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should eltys assignment be outside of if (as you did above in src/abstractdataframe/iteration.jl change)
|
Thank you for working on this. I left two small comments. |
nalimilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's too bad we need this kind of trick but...
src/dataframe/dataframe.jl
Outdated
| end | ||
| len == -1 && (len = 1) # we got no vectors so make one row of scalars | ||
|
|
||
| len_val = len |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this len_local like in other places to make it easier to guess why we do this?
|
Updated |
|
Thank you for working on this. |
I used JuliaLang/julia#60478 to find all the
Core.Boxinstances in the package and then fix them. A variable that gets boxed like this will lose any type information, which can cascade into bad performance and vulnerability to invalidations.The rules are basically that you cannot use a variable in a closure if that variable has been assigned to more than once. Also, using
Base.@lockinstead oflock() doavoids a closure. And if you have a closure that calls itself recursively, it is better to make that a normal function; otherwise, the closure itself will get boxed. Etc...