-
Notifications
You must be signed in to change notification settings - Fork 26
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 force compilation flag to serve #128
Conversation
Hey Rik, thanks for this; I will test this a bit to make sure it doesn't affect the current user experience but before that I have a few questions: can you explain in more details (assume I'm very very dumb which is not far from the truth) why this would be helpful? I'm not sure I understand what is going on. E.g. Could you maybe present a situation where this would be "felt"? I just tried this in the generated directory of the julialang website and Are you suggesting we cut that time further? or just that we don't wait for the browser to finish loading the tab before doing something else? I apologise if this is all dumb but I want to be super sure of what's going on. Also, what does the Thanks! |
May I ask what CPU you have? Here, it is way more than half a second. If I do this in one terminal:
Then, I can go into another and get:
And these three seconds are what I hope to reduce. It's very annoying to go into the browser after having restarted the process for whatever reason (updated deps changed structs probably), refreshing the page and having to wait these seconds. But, I also understand that this is sort of a first-world problem.
I thought it makes sense to give the async process some time to connect to the socket. |
Ah ok so specifically in your use case you require this What's the workflow for Books that you want? (i.e. why do you want to (sorry for all the questions, I'm just trying to be fully clear on what this solves 😂 + whether it's justified to make it a default as opposed to a specific path that could be toggled when Books calls it i.e. have your keyword |
Yeah no worries. You are asking valid questions.
The Books workflow is basically the same as Franklin. The user calls I could just as well implement this very easily in Books.jl, but thought other people could benefit from it too (Franklin and other packages). My idea is to just have this as a hidden thing in LiveServer.jl which isn't noticeable, but speeds things up in the background.
My fear of setting it to false by default is that no one would use it. Typing
I really should get a CPU with better single threaded performance. Yours seems to be 3-6 times as fast. |
Hmm ok I understand the bit about running time information. And the rest are fair points. At the risk of committing sacrilege, I wonder whether similar runtime information could be obtained via some javascript lib or some shell stuff; HTTP.jl is just a bit of a mess though now that Jacob is looking after it things might get quite a bit better. Anyway I think the change you're suggesting is not crazy, I just want to test it heavily before "baking it in", assuming it 'just works' all the time, I'm happy to change things, and we can always get back to it if you find a better way of doing this. PS1: do you think "warming up" PS2: I'm using a fairly beefy work laptop with an i7 processor but I have another slower and older i5 lying around on which I'll do the tests |
Good point.
Not so much. It went from 3.2 seconds to 2.7 seconds JuliaWeb/HTTP.jl#750. Thanks for the CPU info. |
Okay. Makes sense. Feel free to "finish" the PR or close it if you decide to do so after your testing.
The problem with precompilation, as far as I understand, is that it doesn't compile upstream packages. In this case, the culprit is mostly HTTP, so precompiling LiveServer.jl wouldn't help too much. See JuliaLang/julia#42016 for more information. |
I'm gonna go for PackageCompiler.jl. It's a bit of a hassle to manage the right sysimage for each project, but it is much quicker once set up. |
Ah sorry @rikhuijzer for not taking this on, I forgot about it 😕 . Good if you have an alternative that works fine! I've never really managed to successfully use PackageCompiler.jl but maybe should give it another shot. |
No worries. It's not really important :) |
@tlienart this implements the thing I was talking about on Slack. See also JuliaWeb/HTTP.jl#720 for a previous discussion.
Give this PR a very critical review please. For me, this would be a great addition making me life a bit better. However, I'm also aware that it is quite a hacky solution. For example, it wouldn't help people who have "open link in browser" on by default (unless their browser is very slow, then this PR would speed things up a bit).
Also, notice that this is sort of breaking since it defaults to yes. I don't think that it would break any user configuration, but maybe it requires a breaking release.