-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Call UpdateJumplist only if the settings changed #13692
Conversation
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.
What happens if the user restarts their PC, but the settings file hasn't changed? Does the shell remember their jumplist from last time?
Other thought from teams:
|
Jumplists are durable across restarts, for sure. |
I tested it and it works fine.
As mentioned "offline", I'm not convinced that this will bring noticeable improvements. One reason being that an AV like Windows Defender will have a much greater impact on us on first launch than anything we do ourselves. But it is a convincing argument! Unfortunately I got a bit stumped now on how to best implement this... |
Okay idea: In
Thoughts? |
e279408
to
b784500
Compare
I've come up with an easier approach which doesn't need to check |
This comment was marked as outdated.
This comment was marked as outdated.
b784500
to
ccf550b
Compare
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.
Sure let's give it a whirl
@@ -179,18 +179,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model | |||
buffer.erase(0, Utf8Bom.size()); | |||
} | |||
|
|||
if (lastWriteTime) | |||
{ | |||
THROW_IF_WIN32_BOOL_FALSE(GetFileTime(file.get(), nullptr, nullptr, lastWriteTime)); |
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.
THROW
? or LOG
? Can this reasonably fail?
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.
don't think it's much worth worrying about in this case.. hopefully
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.
Oh right I forgot to respond that I think throwing is the right thing to do here. A caller should be able to trust us that we either successfully fill all out parameters or return a failure (exception).
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.
But does this leave the opportunity for an unguarded exception that takes down the app? "Caller" is one thing, but "Terminal the app and its reliability" is another
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.
ReadFile
in the same function throws exceptions as well.
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.
I'm cool with trying this in 1.16 preview
@@ -179,18 +179,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model | |||
buffer.erase(0, Utf8Bom.size()); | |||
} | |||
|
|||
if (lastWriteTime) | |||
{ | |||
THROW_IF_WIN32_BOOL_FALSE(GetFileTime(file.get(), nullptr, nullptr, lastWriteTime)); |
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.
don't think it's much worth worrying about in this case.. hopefully
🎉 Handy links: |
This commit stores a hash of the
settings.json
file inApplicationState
with which we can detect whether the settings contents actually changed.
Since I only use a small 64-bit hash as opposed to SHA2 for instance,
I'm taking the last write time of the file into account as well.
This allows us to skip calling
UpdateJumplist
at least the majority of applaunches which hopefully improves launch performance on devices with slower IO.
Part of #5907.
Validation Steps Performed
FYI For some (...) inexplicable reason, shell task lists are preserved forever
even if msix applications are uninstalled, etc. So to test whether tasks are
properly written on first app launch we have to delete some profiles/tasks
first, otherwise we can't see whether they're actually written later.
settings.json
and relaunchCascadiaSettings::WriteSettingsToDisk
generates the same hash that
LoadAll
reads. ✅