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

Conditional Loading of Packages #193

Closed
TheCedarPrince opened this issue Sep 18, 2020 · 8 comments
Closed

Conditional Loading of Packages #193

TheCedarPrince opened this issue Sep 18, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request hacktoberfest Issue for those participating in Hacktoberfest at any skill level question Further information is requested
Milestone

Comments

@TheCedarPrince
Copy link
Member

Is your feature request related to a problem? Please explain.

I have noticed recently that using Javis seems to be taking much longer than it used to. I ran some benchmarks and it was somewhat concerning:

v0.1.5 Benchmarks:

julia> @time using Javis
 41.913861 seconds (37.30 M allocations: 2.000 GiB, 3.49% gc time)

v0.1.0 Benchmarks:

julia> @time using Javis
[ Info: Precompiling Javis [78b212ba-a7f9-42d4-b726-60726080707e]
 21.673696 seconds (12.55 M allocations: 715.007 MiB, 0.83% gc time)

We have currently doubled the compile time of Javis! 😱

Describe the solution you'd like

I would like to conditionally compile packages as they are needed. Obviously, some packages that are critical would always be loaded but I think we need to identify where the compile time issues come from.

Describe alternatives you've considered

Thanks to a suggestion from @mcabbott I think Requires.jl would help fix this problem.

@TheCedarPrince TheCedarPrince added enhancement New feature or request question Further information is requested labels Sep 18, 2020
@TheCedarPrince TheCedarPrince added this to the v0.2.x milestone Sep 18, 2020
@Wikunia
Copy link
Member

Wikunia commented Sep 21, 2020

Interesting idea but in that case the user would need to write using Gtk, right? Or cans that be avoided as well? I didn't really understand Requires.jl I guess

@TheCedarPrince
Copy link
Member Author

From what I have read and understood about Requires.jl, I think having to write using Gtk can be avoided. I will have to research this a bit more to confirm.

@TheCedarPrince TheCedarPrince added the hacktoberfest Issue for those participating in Hacktoberfest at any skill level label Sep 28, 2020
@Sov-trotter
Copy link
Member

Sov-trotter commented Oct 10, 2020

So does it have it be something like

function __init__()
    @require Gtk="4c0ca9eb-093a-5379-98c5-f87ac0bbbf44" Base.show("Gtk Loaded")
end

Since Requires.jl reads

Suppose you've written a package called MyPkg. MyPkg has core functionality that it always provides; but suppose you want to provide additional functionality if the Gadfly package is also loaded. Requires.jl exports a macro, @require, that allows you to specify that some code is conditional on having both packages available.

But I don't think we need to perform anything apart from just delaying the loading part ?

@TheCedarPrince
Copy link
Member Author

That is my understanding of what Requires.jl would do here. I haven't had much time to look into this. Would you be able to experiment with this functionality to decrease the precompile time @Sov-trotter? I'd be happy to provide support you in creating a PR. 🙂

@Wikunia
Copy link
Member

Wikunia commented Oct 10, 2020

We probably want this only for the image viewer as I assume Gtk requires the most. This assumption needs to be tested 😄 .
In general I believe that precompilation time isn't super important as it should be done only once for all users (except for developers)

Thanks for your comment @Sov-trotter and yeah if you're interested we appreciate your help 😉

@Sov-trotter
Copy link
Member

Sov-trotter commented Oct 11, 2020

Sorry I should've created a PR by now but I am running into the error.

Gtk-Message: 13:18:56.751: Failed to load module "canberra-gtk-module"
Gtk-Message: 13:18:56.751: Failed to load module "canberra-gtk-module"

I tried to fix Gtk based on the other issues on Gtk.jl. Almost bricked gnome in that process. :(

@Sov-trotter Sov-trotter mentioned this issue Oct 11, 2020
7 tasks
@TheCedarPrince
Copy link
Member Author

Hey @Sov-trotter no worries! I have had that error before on Linux-based machines. What machine are you using? If you are using a linux based machine, this solution should assist: https://askubuntu.com/questions/208431/failed-to-load-module-canberra-gtk-module

@Sov-trotter Sov-trotter mentioned this issue Oct 17, 2020
7 tasks
@TheCedarPrince TheCedarPrince modified the milestones: v0.3.x, v0.3.0 Oct 26, 2020
@TheCedarPrince TheCedarPrince self-assigned this Oct 30, 2020
@TheCedarPrince
Copy link
Member Author

Closed due to inability to solve and fix at the moment. May reopen someday!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Issue for those participating in Hacktoberfest at any skill level question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants