Created
July 25, 2021 13:23
-
-
Save timholy/f30ecca60a3154b934f4513f2004b8b2 to your computer and use it in GitHub Desktop.
DataFrames specialization and latency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DataFrames, SnoopCompile, Statistics, ProfileView | |
# Note: load all packages first to prevent invalidation | |
d = DataFrame(n = 1:20, x = [3, 3, 3, 3, 1, 1, 1, 2, 1, 1, | |
2, 1, 1, 2, 2, 2, 3, 1, 1, 2]); | |
g = groupby(d, :x); | |
subset(g, :n => (n -> n .> mean(n))); # compile | |
select(g, :n => (n -> n .> mean(n))); # compile | |
tinf_subset = @snoopi_deep begin | |
subset(g, :n => (n -> n .> mean(n))) | |
end | |
tinf_select = @snoopi_deep begin | |
select(g, :n => (n -> n .> mean(n))) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment