From deaae7e71788a32918cc43341a70cbf8da9e0ed0 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Sat, 13 Sep 2008 00:37:09 +0200 Subject: [PATCH] Ignore gui_mch_update() By making gui_mch_update() a no-op the frame-rate is dramatically increased in certain situations. The downside is that it is no longer possible to interrupt Vim with Ctrl-C when it is busy processing. --- src/MacVim/MMBackend.m | 4 ---- src/MacVim/gui_macvim.m | 38 ++++---------------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 1c21b12685..13ff066638 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -466,10 +466,6 @@ static NSString *MMSymlinkWarningString = - (void)update { - // Tend to the run loop, returning immediately if there are no events - // waiting. - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode - beforeDate:[NSDate distantPast]]; } - (void)flushQueue:(BOOL)force diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 990a07d298..39880d83bb 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -20,10 +20,6 @@ -// This constant controls how often [MMBackend update] may get called (see -// gui_mch_update()). -static NSTimeInterval MMUpdateTimeoutInterval = 0.1f; - // NOTE: The default font is bundled with the application. static NSString *MMDefaultFontName = @"DejaVu Sans Mono"; static float MMDefaultFontSize = 12.0f; @@ -185,39 +181,13 @@ gui_mch_open(void) * nothing in the X event queue (& no timers pending), then we return * immediately. */ -#define MM_LOG_UPDATE_STATS 0 void gui_mch_update(void) { - // NOTE: This function can get called A LOT (~1 call/ms) and unfortunately - // checking the run loop takes a long time, resulting in noticable slow - // downs if it is done every time this function is called. Therefore we - // make sure that it is not done too often. - static NSDate *lastUpdateDate = nil; -#if MM_LOG_UPDATE_STATS - static int skipCount = 0; -#endif - - if (lastUpdateDate && -[lastUpdateDate timeIntervalSinceNow] < - MMUpdateTimeoutInterval) { -#if MM_LOG_UPDATE_STATS - ++skipCount; -#endif - return; - } - -#if MM_LOG_UPDATE_STATS - NSTimeInterval dt = -[lastUpdateDate timeIntervalSinceNow]; - NSLog(@"Updating (last update %.2f seconds ago, skipped %d updates, " - "approx %.1f calls per second)", - dt, skipCount, dt > 0 ? skipCount/dt : 0); - skipCount = 0; -#endif - - [[MMBackend sharedInstance] update]; - - [lastUpdateDate release]; - lastUpdateDate = [[NSDate date] retain]; + // This function is called extremely often. By doing nothing here the + // frame-rate is increased dramatically in certain situations. However, + // the downside is that it is often not possible to interrupt Vim with + // Ctrl-C when it is busy processing. }