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.
This commit is contained in:
Bjorn Winckler
2008-09-13 00:37:09 +02:00
parent e52ae8cbc0
commit deaae7e717
2 changed files with 4 additions and 38 deletions
-4
View File
@@ -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
+4 -34
View File
@@ -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.
}