-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster in-place ntoh
#101
Faster in-place ntoh
#101
Conversation
Not sure why you closed? Some questions
|
I think we should disable |
Just tested this PR vs julia> using UnROOT
julia> const t = LazyTree(ROOTFile("uncompressed_Run2012BC_DoubleMuParked_Muons.root"), "Events");
julia> function foo(t)
s = 0.0f0
for evt in t
s += sum(evt.Muon_pt)
end
s
end
foo (generic function with 1 method)
julia> @benchmark foo(t)
|
With a benchmark where I don't loop over the elements I get julia> function foo2(t)
for evt in t
evt.Muon_pt
end
end
foo2 (generic function with 1 method)
julia> @benchmark foo2(t) seconds=15 # master
BenchmarkTools.Trial: 17 samples with 1 evaluation.
Range (min … max): 851.025 ms … 991.843 ms ┊ GC (min … max): 6.61% … 6.04%
Time (median): 876.236 ms ┊ GC (median): 6.92%
Time (mean ± σ): 889.033 ms ± 40.918 ms ┊ GC (mean ± σ): 6.75% ± 0.29%
Memory estimate: 1.82 GiB, allocs estimate: 14304.
julia> @benchmark foo2(t) seconds=15 # PR
BenchmarkTools.Trial: 17 samples with 1 evaluation.
Range (min … max): 769.904 ms … 873.306 ms ┊ GC (min … max): 5.60% … 5.41%
Time (median): 795.748 ms ┊ GC (median): 5.84%
Time (mean ± σ): 800.257 ms ± 23.881 ms ┊ GC (mean ± σ): 5.78% ± 0.20%
Memory estimate: 1.26 GiB, allocs estimate: 14602. but it's kind of a dumb benchmark? |
at least
so I think in some cases this would be faster |
if J == Nojagg | ||
return ntoh.(reinterpret(T, rawdata)) | ||
ϖ = convert(Ptr{eltype(T)}, pointer(rawdata)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ϖ
:(
offset[i+1] = offset[i] + l | ||
else | ||
# when we have an empty [] in jagged basket | ||
offset[i+1] = offset[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this else
?
You guys will have to tell me how horrible this PR is.
Before:
After: