Skip to content

implement @time and @timev in terms of @timed#52889

Merged
IanButterworth merged 6 commits intoJuliaLang:masterfrom
ericphanson:eph/timed-time
Jan 20, 2024
Merged

implement @time and @timev in terms of @timed#52889
IanButterworth merged 6 commits intoJuliaLang:masterfrom
ericphanson:eph/timed-time

Conversation

@ericphanson
Copy link
Contributor

@ericphanson ericphanson commented Jan 13, 2024

closes #47056

I suspect there was some reason this wasn't done in the first place, but I figured opening a PR could be a way to discuss that.

Needs tests still for the new @timed fields.

@IanButterworth
Copy link
Member

Sounds good to me. We'd need to check that we're not hitting unexpected compilation due to this change.

@ericphanson
Copy link
Contributor Author

Do you know a good way to do that?

I tried the example from #48024 (comment):

./julia --startup-file=no -q
julia> double(x::Real) = 2x
double (generic function with 1 method)

julia> calldouble(container) = double(container[1])
calldouble (generic function with 1 method)

julia> calldouble2(container) = calldouble(container)
calldouble2 (generic function with 1 method)

julia> @time @eval calldouble([1.0])
  0.009445 seconds (2.48 k allocations: 116.594 KiB, 30.16% compilation time) # master
  0.007254 seconds (2.48 k allocations: 116.594 KiB, 30.60% compilation time) # PR
2.0

julia> @time @eval calldouble2(1.0)
  0.002668 seconds (3.81 k allocations: 194.422 KiB, 93.59% compilation time) # master
  0.003196 seconds (3.81 k allocations: 194.422 KiB, 95.07% compilation time) # PR
2.0

which at least looks similar, though I don't know if it means anything.

@IanButterworth IanButterworth added the needs news A NEWS entry is required for this change label Jan 13, 2024
@IanButterworth
Copy link
Member

Needs news for the new fields

@ericphanson
Copy link
Contributor Author

do we like these field names? we could do compilation_time instead of compile_time since that's how I refer to it in the docstring, though having it shorter seems a bit nicer

@IanButterworth
Copy link
Member

compile_time is understandable and shorter is nicer IMO

@IanButterworth IanButterworth removed the needs news A NEWS entry is required for this change label Jan 14, 2024
Co-authored-by: inky <git@wo-class.cn>
Copy link
Member

@IanButterworth IanButterworth left a comment

Choose a reason for hiding this comment

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

LGTM. Avoids duplication and the consistency in outputs seems good to me

@IanButterworth IanButterworth merged commit 32534dd into JuliaLang:master Jan 20, 2024
@ericphanson ericphanson deleted the eph/timed-time branch January 20, 2024 17:56
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.

@timed does not report compile/recompile times whereas @time does.

3 participants