From dc364d99d589be9323191daf2a5e337f45da1667 Mon Sep 17 00:00:00 2001 From: Scott Perry Date: Wed, 16 Oct 2013 23:12:09 -0700 Subject: [PATCH] Performance improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NNKit commit 6107640b7d051bb34431dcf01030815537937266 significantly reduces dogpiling on the part of the window content polling objects, but the real change here is moving `[self.store startUpdatingWindowContents]` to run after the interface has been set to display—the rendering thread takes long enough when the views its rendering are not changing, updating the contents of the most expensive layers before any have been drawn to the screen creates a feedback loop: the renderer is delayed, having to catch up on more updates, which gives the polling objects more time to queue more updates. Unfortunately #30 is still a problem, but this improves things significantly. --- Frameworks/NNKit | 2 +- Switch/NNCoreWindowController.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Frameworks/NNKit b/Frameworks/NNKit index 91430250..6107640b 160000 --- a/Frameworks/NNKit +++ b/Frameworks/NNKit @@ -1 +1 @@ -Subproject commit 9143025042d76f94f51f9e2cdd72e26cb2b3a9e1 +Subproject commit 6107640b7d051bb34431dcf01030815537937266 diff --git a/Switch/NNCoreWindowController.m b/Switch/NNCoreWindowController.m index 7558780c..f53ff702 100644 --- a/Switch/NNCoreWindowController.m +++ b/Switch/NNCoreWindowController.m @@ -31,7 +31,7 @@ NSString const *NNCoreWindowControllerActiveKey = @"NNCoreWindowControllerActiveKey"; -static NSTimeInterval kNNWindowDisplayDelay = 0.15; +static NSTimeInterval kNNWindowDisplayDelay = 0.1; @interface NNCoreWindowController () @@ -154,6 +154,7 @@ - (void)setUpReactions; if ([shouldDisplayInterface boolValue]) { [self.window setFrame:[NSScreen mainScreen].frame display:YES]; [self.window orderFront:self]; + [self.store startUpdatingWindowContents]; NNLog(@"Showed interface (%.3fs elapsed)", [[NSDate date] timeIntervalSinceDate:self.invocationTime]); } else { NNLog(@"Hiding interface (%.3fs elapsed)", [[NSDate date] timeIntervalSinceDate:self.invocationTime]); @@ -363,7 +364,6 @@ - (void)store:(NNWindowStore *)store didChangeWindow:(NNWindow *)window atIndex: - (void)storeDidChangeContent:(NNWindowStore *)store; { if (!self.windowListLoaded) { - [self.store startUpdatingWindowContents]; NNLog(@"Window list loaded with %lu windows (%.3fs elapsed)", (unsigned long)self.windows.count, [[NSDate date] timeIntervalSinceDate:self.invocationTime]); self.windowListLoaded = YES; }