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

Add explanation about top-level compilation to timing macros #39802

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

IanButterworth
Copy link
Member

Following discussions in #39760

Text based on @JeffBezanson's edits in JuliaLang/www.julialang.org@ef6846d

@IanButterworth
Copy link
Member Author

To illustrate the need for this note

julia> @eval function f(a)  # Expensive function to compile. (Thanks @yuyichao!)
                         $(quote $([:(a = a + a * 10 + (a > 0 ? $i : 0.2)) for i in 1:401]...) end)
                         $(quote $([:(a = a + a * 10 + (a > 0 ? $i : 0.2)) for i in 1:401]...) end)
                         return a
                     end
f (generic function with 1 method)

julia> @time f(2)
  0.000000 seconds
julia> @eval function f(a)  # Expensive function to compile. (Thanks @yuyichao!)
                         $(quote $([:(a = a + a * 10 + (a > 0 ? $i : 0.2)) for i in 1:401]...) end)
                         $(quote $([:(a = a + a * 10 + (a > 0 ? $i : 0.2)) for i in 1:401]...) end)
                         return a
                     end
f (generic function with 1 method)

julia> @time @eval f(2)
 13.801006 seconds (6.26 M allocations: 317.365 MiB, 3.65% gc time, 100.02% compilation time)

@Keno
Copy link
Member

Keno commented Feb 23, 2021

I wonder if there is some way that we can have the former expression hint that compile time was excluded. I guess we could have the REPL check if what you're evaling is a literal @time ... and give you a hint, but that might be a little out there. I'm just a big fan of in-context discovery, since I basically never read the docs ;)

@ufechner7
Copy link

Looks good to me. :)

@ufechner7
Copy link

What is the reason for the failure on linux32? Is this ready to be merged?

@ufechner7
Copy link

Bump.

@DilumAluthge
Copy link
Member

@JeffBezanson @Keno What are your thoughts on this PR?

@KristofferC KristofferC merged commit dca0850 into JuliaLang:master Mar 16, 2021
@IanButterworth IanButterworth deleted the ib/time_docstring branch March 16, 2021 12:55
@ufechner7
Copy link

ufechner7 commented Mar 16, 2021

Can this PR get a backport label? It would be nice to have it in 1.6 .

@KristofferC KristofferC added the backport 1.6 Change should be backported to release-1.6 label Mar 16, 2021
KristofferC pushed a commit that referenced this pull request Mar 23, 2021
@KristofferC KristofferC mentioned this pull request Mar 23, 2021
10 tasks
KristofferC pushed a commit that referenced this pull request Mar 23, 2021
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Mar 26, 2021
KristofferC pushed a commit that referenced this pull request Apr 4, 2021
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
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.

5 participants