jrevels commented on PR #493:
URL: https://github.com/apache/arrow-julia/pull/493#issuecomment-1839458969
Did some benchmarking, looks like there is a small perf hit here to the
general case that needs to be mitigated before this can be merged:
```jl
using Arrow, ArrowTypes, Random, BenchmarkTools
struct Foo
a::Int
b::String
c::Vector{String}
d::Float64
end
ArrowTypes.arrowname(::Type{Foo}) = Symbol("JuliaLang.Foo")
ArrowTypes.JuliaType(::Val{Symbol("JuliaLang.Foo")}, T) = Foo
genfoo() = Foo(rand(1:10), randstring(10), [randstring(10) for _ in
1:rand(2:5)], rand())
t = (; f = [genfoo() for _ in 1:1000])
f = Arrow.Table(Arrow.tobuffer(t)).f
@benchmark sum(x -> x.d, $f)
```
results on `jrevels:jr/structelement`
```
BenchmarkTools.Trial: 6891 samples with 1 evaluation.
Range (min … max): 631.291 μs … 2.410 ms ┊ GC (min … max): 0.00% …
70.30%
Time (median): 646.250 μs ┊ GC (median): 0.00%
Time (mean ± σ): 724.383 μs ± 299.599 μs ┊ GC (mean ± σ): 10.04% ±
15.20%
█▅▃▁ ▂▂ ▁
████▆▆▅▄▁▁▁▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃███ █
631 μs Histogram: log(frequency) by time 1.95 ms <
Memory estimate: 2.53 MiB, allocs estimate: 22470.
```
results on `main`
```
BenchmarkTools.Trial: 8118 samples with 1 evaluation.
Range (min … max): 531.667 μs … 2.338 ms ┊ GC (min … max): 0.00% …
73.71%
Time (median): 550.333 μs ┊ GC (median): 0.00%
Time (mean ± σ): 614.904 μs ± 266.473 μs ┊ GC (mean ± σ): 9.82% ±
14.78%
█▇▄▂ ▁▂▁ ▁
████▇▆▄▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███ █
532 μs Histogram: log(frequency) by time 1.78 ms <
Memory estimate: 2.23 MiB, allocs estimate: 18482.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]