Skip to content
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

force specialization on arguments to core wrapper #124

Merged
merged 1 commit into from
Oct 22, 2018

Conversation

KristofferC
Copy link
Contributor

@KristofferC KristofferC commented Oct 18, 2018

Sometimes defining a function as f(a, b, c) = g(a, b, c) might mean that the specialization heuristic kicks in when the type of an argument is a Function or Type. This leads to issues like JuliaLang/julia#28087 and #71.

One possible way around this is to force specialization using where. This might make sense since presumably, we want this core wrapper to be "as invisible as possible".

Fixes #71.

julia> b1 = @benchmarkable rand($Float64); tune!(b1); run(b1)
BenchmarkTools.Trial:
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     5.333 ns (0.00% GC)
  median time:      6.078 ns (0.00% GC)
  mean time:        6.379 ns (0.00% GC)
  maximum time:     23.800 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     1000

Copy link
Member

@jrevels jrevels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ararslan ararslan merged commit af35d05 into master Oct 22, 2018
@ararslan ararslan deleted the kc/force_spec_in_core branch October 22, 2018 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants