visr / LasIO.jl

Julia package for reading and writing the LAS lidar format.
Other
22 stars 13 forks source link

Generated method for read is slower than non-generated one #14

Closed evetion closed 5 years ago

evetion commented 6 years ago

While simpler version benchmarked linked at https://github.com/Keno/StructIO.jl/issues/13 (https://gist.github.com/evetion/2b57d6105cca39b2d3c6ef670a5cc393) is not.


Original function
  85.615 ms (994614 allocations: 32.26 MiB)
New function using generated read
  105.606 ms (994614 allocations: 32.26 MiB)```
evetion commented 5 years ago

I cannot reproduce this anymore. Old versions have GC influence, on latest the generated method seems faster. Used the following script (placed in LasIO root dir): https://gist.github.com/evetion/b7f669df7684bb3df650c884d2649bd7

On version 6:

➜ in git/LasIO.jl on  master [?] took 3s julia6 bench_gen.jl
----
New:     0.112777 seconds (2.49 M allocations: 37.959 MiB, 56.51% gc time)
Old:     0.051623 seconds (2.49 M allocations: 37.959 MiB, 8.76% gc time)

➜ in git/LasIO.jl on  master [?] took 3s julia6 bench_gen.jl
----
Old:     0.108885 seconds (2.49 M allocations: 37.959 MiB, 55.33% gc time)
New:     0.055548 seconds (2.49 M allocations: 37.959 MiB, 9.59% gc time)

On 7 (notice GC not running)

➜ in git/LasIO.jl on  master [?] took 2s julia7 bench_gen.jl
----
Old:     0.120513 seconds (2.49 M allocations: 37.959 MiB, 55.66% gc time)
New:     0.044668 seconds (2.49 M allocations: 37.959 MiB)

➜ in git/LasIO.jl on  master [?] took 3s julia7 bench_gen.jl
----
New:     0.117245 seconds (2.49 M allocations: 37.959 MiB, 56.26% gc time)
Old:     0.048513 seconds (2.49 M allocations: 37.959 MiB)

Julia 1.1 rc1

➜ in git/LasIO.jl on  master [?] julia bench_gen.jl
----
New:     0.005911 seconds
Old:     0.006505 seconds

➜ in git/LasIO.jl on  master [?] julia bench_gen.jl
----
Old:     0.006827 seconds
New:     0.005951 seconds
visr commented 5 years ago

That's good news, thanks for checking!