Skip to content

Commit

Permalink
Test generate and replace without @with
Browse files Browse the repository at this point in the history
  • Loading branch information
korenmiklos committed Sep 19, 2024
1 parent 61e2e96 commit bb9862e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions docs/examples/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ using Pkg; Pkg.precompile()
df = DataFrame(i = 1:10_000_000)
df.g = rand(0:99, nrow(df))


println("Generate")
@btime @with df @generate ln_i = log(i)
setdf(df)
@time @generate ln_i = log(i)
setdf(df)
@time @generate ln_i = log(i)

setdf(df)

println("Replace")
@btime @with df @replace g = 2*i
@btime @replace g = 2*i

println("Egen")
@btime @with df @egen mean_i = mean(i), by(g)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end
| Command | Stata | Julia 2nd run | Speedup |
| ------------ | ----- | ------------- | ------- |
| `@generate` | 230ms | 46ms | 5x |
| `@replace` | 232ms | 43ms | 5x |
| `@replace` | 232ms | 32ms | 7x |
| `@egen` | 5.00s | 0.37s | 13x |
| `@collapse` | 0.94s | 0.28s | 3x |
| `@tabulate` | 2.19s | 0.09s | 24x |
Expand Down

0 comments on commit bb9862e

Please sign in to comment.