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

Improve examples in the manual in basics.md #3236

Merged
merged 4 commits into from
Dec 24, 2022
Merged

Improve examples in the manual in basics.md #3236

merged 4 commits into from
Dec 24, 2022

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Dec 4, 2022

Small improvements based on user feedback

@bkamins bkamins requested a review from nalimilan December 4, 2022 15:07
@bkamins bkamins added the doc label Dec 4, 2022
@bkamins bkamins modified the milestones: 1.5, patch Dec 4, 2022
docs/src/man/basics.md Outdated Show resolved Hide resolved
docs/src/man/basics.md Outdated Show resolved Hide resolved
docs/src/man/basics.md Outdated Show resolved Hide resolved
Comment on lines 412 to 413
Alternatively you could use a comprehension like this:
`[a in [1, 5, 601] for a in df.A]`.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@bkamins
Copy link
Member Author

bkamins commented Dec 24, 2022

Thank you!

@bkamins bkamins merged commit be13650 into main Dec 24, 2022
@bkamins bkamins deleted the bk/doc_basics branch December 24, 2022 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants