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 precompile helper #35

Merged
merged 6 commits into from
Mar 7, 2021
Merged

Add precompile helper #35

merged 6 commits into from
Mar 7, 2021

Conversation

IanButterworth
Copy link
Contributor

No description provided.

@timholy
Copy link
Contributor

timholy commented Feb 25, 2021

Let's hold off on this for a second; I took a quick look myself, and it seems there are quite a few inference problems that can be fixed. Once you eat dessert it's actually harder to eat your vegetables because the caching masks triggers of inference.

EDIT: xref #36

@codecov-io
Copy link

codecov-io commented Feb 25, 2021

Codecov Report

Merging #35 (4825d21) into master (31191cb) will decrease coverage by 14.35%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #35       +/-   ##
===========================================
- Coverage   88.79%   74.43%   -14.36%     
===========================================
  Files          12       13        +1     
  Lines         562      669      +107     
===========================================
- Hits          499      498        -1     
- Misses         63      171      +108     
Impacted Files Coverage Δ
src/TiffImages.jl 100.00% <ø> (ø)
src/precompile.jl 0.00% <0.00%> (ø)
src/ifds.jl 97.61% <0.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31191cb...4825d21. Read the comment docs.

@IanButterworth
Copy link
Contributor Author

IanButterworth commented Feb 25, 2021

@timholy Small thought.. The timings in the precompile directives file are nice, but frustratingly break git diffs, so it's harder to tell what changes. Any way to have the best of both worlds..? 🤔

@timholy
Copy link
Contributor

timholy commented Feb 25, 2021

One point: you could conceivably just use precomp_gen.jl as the precompiler. Yes, you'd be creating actual objects when the package gets compiled, but that's not the worst thing in the world, and it is shorter. Check out the precompile file in JuliaImages/ImageCore.jl#157. You would have to return something so that the compiler doesn't decide to elide all the precompilation code, but that shouldn't be too hard.

Another one: if you do keep the explicit precompile directives, I almost always put an @assert in front of them now so I know when they go stale.

@IanButterworth
Copy link
Contributor Author

I'm a bit confused as to why codecov is reporting a reduction here, but should be good to merge @tlnagy

@IanButterworth
Copy link
Contributor Author

Oh.. right, codecov is being run on both 1.5 and nightly. So on one the precompiles are being skipped

@tlnagy
Copy link
Owner

tlnagy commented Mar 2, 2021

This looks good to me. Why are the precompiles only included for 1.6-dev+?

Also will I need to rerun this on every release?

@IanButterworth
Copy link
Contributor Author

IanButterworth commented Mar 2, 2021

I was being lazy and hadn't checked that they pass for 1.5. Just updated as it works locally for 1.5.3.
If you want to check that they work for older versions, feel free to update or merge (once the CI re-runs)

@IanButterworth
Copy link
Contributor Author

IanButterworth commented Mar 2, 2021

Also will I need to rerun this on every release?

That is one of the down-sides of precompile directives over just running some code, which @timholy was advocating for above. I didn't go that way because snooping.jl uses the whole test suite to generate precompile directives, so should have better coverage than that just in precomp_gen.jl, minus the include at the end. If you think that's enough, then we could just run that code during precomp instead.

@timholy
Copy link
Contributor

timholy commented Mar 2, 2021

FYI I've not noticed downsides to precompiling for any version after 1.4.2, as long as they are the same precompiles. But before 1.4.2 you can trigger segfaults by precompiling so it's better to be safe.

@tlnagy
Copy link
Owner

tlnagy commented Mar 3, 2021

Also will I need to rerun this on every release?

If you think that's enough, then we could just run that code during precomp instead.

I think I would prefer that. I know myself and I'll struggle to remember to rebuild the precompilation signatures regularly.

Could you also add N0f16 and Float32 to the type list? I think that should cover common use cases.

@IanButterworth
Copy link
Contributor Author

Great, yeah that simplifies this then. I also added GrayA and RGBA.

This PR should be squash merged. I didn't rebase squash in case anyone wants to review the intermediate snoop scripts in the future.

@timholy looks like FileIO is hitting a precompile directive error on nightly on != ubuntu

ERROR: LoadError: AssertionError: precompile(f, (Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(load), String))
Stacktrace:
 [1] _precompile_()
   @ FileIO ~/.julia/packages/FileIO/C7O10/src/precompile.jl:52

@IanButterworth IanButterworth changed the title Set up SnoopCompile precompiles Add precompile helper Mar 3, 2021
@timholy
Copy link
Contributor

timholy commented Mar 3, 2021

looks like FileIO is hitting a precompile directive error on nightly on != ubuntu

That will be fixed when JuliaIO/FileIO.jl#295 merges. Should I go ahead and do that or wait longer? From my standpoint it's ready.

@IanButterworth
Copy link
Contributor Author

I just commented. Sorry, not had time to give the diff a proper review, but from my perspective I see no reason to not go ahead if you consider it ready

@tlnagy
Copy link
Owner

tlnagy commented Mar 5, 2021

Can I go ahead and merge this? Little confused by the linked issue.

@IanButterworth
Copy link
Contributor Author

It should be safe to merge, but you might want to re-run CI to check?

@tlnagy tlnagy closed this Mar 6, 2021
@tlnagy tlnagy reopened this Mar 6, 2021
@IanButterworth
Copy link
Contributor Author

If we can merge this, can we get out a new release and merge the FileIO Tiff update?

(On my phone, hence the lack of PR links)

@tlnagy tlnagy merged commit a02958f into tlnagy:master Mar 7, 2021
@IanButterworth IanButterworth deleted the ib/precomp branch March 7, 2021 05:00
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.

4 participants