JuliaCI / JuliaCI/BenchmarkTools.jl
$x should become $(Ref(x))[]?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 684
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Description
It's a bit annoying when you have to use this convoluted Ref trick to prevent the compiler from constant-folding the whole calculation (ala #130):
julia> @btime exp(1);
0.052 ns (0 allocations: 0 bytes)
julia> @btime exp($(Ref(1))[]);
13.785 ns (0 allocations: 0 bytes)
It would be nicer if we could just use @btime exp($1) and the $ did the trick automatically.
(Another case just came up on discourse. cc @stillyslalom)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two @btime examples in the issue and reading the surrounding BenchmarkTools macro behavior. Determine how interpolated expressions are handled and define the expected behavior for @btime exp($1), including the discourse-linked vector and tuple case; done means the requested syntax avoids unwanted constant folding without requiring Ref.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100