-
Notifications
You must be signed in to change notification settings - Fork 370
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
Improve examples in the manual in basics.md #3236
Conversation
Alternatively you could use a comprehension like this: | ||
`[a in [1, 5, 601] for a in df.A]`. |
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.
But this is slower as it recreates the array, right?
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.
Yes:
julia> length(x)
1000000
julia> @time [a in [1, 5, 601] for a in x];
0.066654 seconds (1.06 M allocations: 80.224 MiB, 10.75% gc time, 32.44% compilation time)
julia> in.(x, Ref([1, 5, 601]));
julia> @time in.(x, Ref([1, 5, 601]));
0.002442 seconds (8 allocations: 126.547 KiB)
julia> @time in([1, 5, 601]).(x);
0.002134 seconds (8 allocations: 126.531 KiB)
I will add this 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.
added
Co-authored-by: Milan Bouchet-Valat <[email protected]>
Thank you! |
Small improvements based on user feedback