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 a precompile workload #384

Merged
merged 2 commits into from
Jan 4, 2023

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Jan 4, 2023

vroom vroom on 1.9, and halves the time on 1.8

master

julia> @time using VideoIO
  2.099601 seconds (4.06 M allocations: 289.931 MiB, 4.39% gc time, 5.40% compilation time: 1% of which was recompilation)

julia> imgstack = map(_->rand(UInt8, 10, 10), 1:10);

julia> @time begin
           fname = string(tempname(), ".mp4")
           VideoIO.save(fname, imgstack)
           VideoIO.save(fname, VideoIO.load(fname)) # the loaded video is RGB type
           r = openvideo(fname)
           img = read(r)
           while !eof(r)
               read!(r, img)
           end
           seek(r, 0.1)
           seekstart(r)
           skipframe(r)
           skipframes(r, 3)
           gettime(r)
           counttotalframes(r)
       end
  1.683524 seconds (4.56 M allocations: 234.308 MiB, 4.05% gc time, 98.63% compilation time)
10

PR on 1.8

julia> @time using VideoIO
  2.312653 seconds (4.35 M allocations: 311.221 MiB, 5.59% gc time, 3.93% compilation time: 2% of which was recompilation)

julia> imgstack = map(_->rand(UInt8, 10, 10), 1:10);

julia> @time begin
           fname = string(tempname(), ".mp4")
           VideoIO.save(fname, imgstack)
           VideoIO.save(fname, VideoIO.load(fname)) # the loaded video is RGB type
           r = openvideo(fname)
           img = read(r)
           while !eof(r)
               read!(r, img)
           end
           seek(r, 0.1)
           seekstart(r)
           skipframe(r)
           skipframes(r, 3)
           gettime(r)
           counttotalframes(r)
       end
  1.010267 seconds (147.65 k allocations: 4.662 MiB, 97.82% compilation time)
10

PR on 1.9

julia> @time using VideoIO
  1.868270 seconds (2.87 M allocations: 191.395 MiB, 4.09% gc time, 0.37% compilation time)

julia> imgstack = map(_->rand(UInt8, 10, 10), 1:10);

julia> @time begin
           fname = string(tempname(), ".mp4")
           VideoIO.save(fname, imgstack)
           VideoIO.save(fname, VideoIO.load(fname)) # the loaded video is RGB type
           r = openvideo(fname)
           img = read(r)
           while !eof(r)
               read!(r, img)
           end
           seek(r, 0.1)
           seekstart(r)
           skipframe(r)
           skipframes(r, 3)
           gettime(r)
           counttotalframes(r)
       end
  0.025577 seconds (4.00 k allocations: 114.242 KiB, 15.64% compilation time)
10

@IanButterworth IanButterworth merged commit 6f766a3 into JuliaIO:master Jan 4, 2023
@IanButterworth IanButterworth deleted the IB/precompile branch January 4, 2023 02:43
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.

1 participant