Skip to content
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

Smarter @eachrow #249

Closed
pdeffebach opened this issue May 18, 2021 · 3 comments
Closed

Smarter @eachrow #249

pdeffebach opened this issue May 18, 2021 · 3 comments

Comments

@pdeffebach
Copy link
Collaborator

As noted in #248, we currently always make a full copy of df in every @eachrow. Users perform the code

s = let x = 0
    @eachrow df begin 
        x += 1
    end
    x
end

and expect fast code, when in actuality we are creating a whole new data frame and there will be tons of allocations.

I'm not sure there's a lot we can do. It makes me wonder if we should make the ! as the default for everything so users always get the fastest code.

@bkamins
Copy link
Member

bkamins commented May 18, 2021

I assume @eachrow can mutate the copy of df. Right?

In this case I think it is OK that it makes a copy. However, I think it would be good to clearly highlight in the documentation in what cases what solution should be used.

@pdeffebach
Copy link
Collaborator Author

Yes. I will emphasize the copying aspect and discuss performance in docstrings in #248

@nalimilan
Copy link
Member

Yeah the behavior is potentially confusing but it makes sense in general. The only case when it's weird is when you don't mutate columns but only accumulate into a global variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants