-
-
Notifications
You must be signed in to change notification settings - Fork 524
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
Reduce startup time by 55% #719
Conversation
Good catch on the startup time! However, I don't really like the version handling. That way you don't have to mess with absolute paths that might not work if the package is zipped, for example. Also, if the file is only created on travis for the build, then it will not be there for people installing from source. |
@pspeter I tend to agree with you, actually. The idea that @wren implemented in b4fda4d was essentially to use the git tag as the source of truth for versioning. I think that's clever, but it also feels backwards - the version should depend on the code, not on how it's stored. @wren What was the rationale for doing it that way? What if we use the |
As a developer I can understand the need for a single source of truth to avoid mismatches. That's why tools like bump2version exist, I guess. |
Agreed - let's have @wren weigh in here and decide on a cleaner way to handle version authority. |
For the versioning question: I strongly believe that the version should have a single source of truth. And since the git tag is easiest to update, I tend to prefer using that. I completely agree that it seems backwards, but I believe that's because the process was incomplete in this repo. I put That being said, we are relying on the toml file to read in the version, which turns out to be pretty slow (great catch on the startup time, by the way, @maebert). But there's really no reason we can't store the version in multiple places as long as nobody has to manually update anything (because then there's the potential to wreck our single source of truth). With this in mind, I added a bot to the build process that will update the version during deployment and commit the change back into the repo (this was my original intent with my partially completed work; I'm sorry I didn't make that more clear to everyone). With this bot in place, we can store the version in multiple places (like the toml file, and a version file) without having to worry about our source of truth. What this bot doesn't fix, though, is the startup slowness. For that, I prefer the approach of storing the version in a separate file that is easier to access. I personally don't think the difference between I think this commit in the Poetry repo is a good example of what our bot commits will look like when everything is in place. |
Oh! Also, for the version output update (#697): I know it's an easy fix, but I want to encourage new contributors to submit more PRs. If we yank the work out from under them, they're less likely to submit more PRs in the future. Can you leave that out of this PR for now? We can always put it in later if the PR doesn't pan out. |
Agreed.
I'm not sure I agree here. I don't see why it's any more difficult to have the source of truth be the
Great call. |
I'm not sure I explained what I was saying very well, because reading your response sounds to me like we're saying the same thing. My intent is to keep the version in the source (both in the
The version won't be (and currently isn't) invisible in the source code (the
This is already what we're doing (although it's only happening in the toml file right now, but we can add a version file pretty easily). What you'll see when a new release comes out, is a commit by our bot account (like this one) that will update the relevant files (along with all of the other release stuff it needs to do). So, to clarify, when I say the source of truth, it's because that's the only place that I am editing the value. We can't pass the version number by reference without incurring some performance penalties, so we rely on the bot to propagate it for us to the correct locations whenever we tag a release. Therefore, nobody should ever edit the value anywhere else. I realize that isn't the strict definition of SSOT, so maybe that's where our miscommunication lies. Am I making more sense? Or was I misunderstanding you? |
This is not really the place to discuss this, but I agree with @alichtman here. One problem of having a bot change the version after the tag is that the tagged commit now always has the wrong version in the source code - it will always be one version behind. |
I found one script that looks pretty good to me. Maybe you can draw some inspiration from it: |
Ah, ok. Makes more sense now. I do think it's important for there to be a way to bump the version manually for arbitrary test installs. |
9db17eb
to
80b376b
Compare
One thought on
|
Okay, it sounds like we need to have more talks about this. How about we take it to the original ticket (#715)? |
Hi! This is good. I'll get this tested on and merged in on Tuesday. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Let's have a look at import times before the changes (visualised with tuna):
poetry run poetry run python -X importtime -m jrnl 2> imports.txt tuna imports.txt
We can see that the main culprits is
pkg_resources
, taking 54% of our total startup time. So instead of going through the system to ask which version of jrnl is installed, this PR bakes a file with the version number before building it on Travis.Let's look at it after the change:
Note
This only measures the import time for modules, not any execution that happens after the imports. There's a bunch of stuff we can do to optimize that too, for example YAML loading is notoriously slow.
Other minor changes
asteval
takes suspiciously long to import, so I've delayed the import of that too.jrnl --version
(closes new version output #697)Checklist