Skip to content

Commit 2d319ad

Browse files
authored
Merge pull request #378 from jeremiahpslewis/performance_tips
Add Performance Tips docs
2 parents 6087d3f + f6cd7b1 commit 2d319ad

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

docs/make.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ makedocs(
4545
],
4646
"Reference Manual" => [
4747
"Global settings" => "referencemanual/global.md",
48-
"Outputs" => "referencemanual/output.md"]
48+
"Outputs" => "referencemanual/output.md",
49+
"Performance tips" => "referencemanual/performance.md",
50+
]
4951
]
5052
)
5153

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Performance Tips
2+
3+
[VegaLite.jl](https://github.com/queryverse/VegaLite.jl) does many things to make plotting easy and fun; for some tasks, a little help from an advanced user goes a long way. Here
4+
are a few tips for improving plotting speeds.
5+
6+
7+
## Example 1: DataFrame with many columns, only a couple are used
8+
9+
In order to speed up plotting, only pass necessary columns to the ``@vplot`` macro.
10+
11+
```julia
12+
using VegaLite, DataFrames
13+
14+
df = DataFrame(rand(100, 1000))
15+
16+
@time df |> @vlplot(:point, x=:x1, y=:x2)
17+
# 58.488104 seconds (8.79 M allocations: 519.253 MiB, 0.36% gc time)
18+
19+
@time select(df, [:x1, :x2]) |> @vlplot(:point, x=:x1, y=:x2)
20+
# 0.382024 seconds (733.50 k allocations: 45.077 MiB, 4.41% gc time, 61.54% compilation time)
21+
```

0 commit comments

Comments
 (0)