From fdd749210d8a813332d8789634b8c82aae14e9d7 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 14 Aug 2021 21:54:08 +1000 Subject: Optimize by reducing invalidation as this can be costly. If all of the text area or margin area is invalidated then remember this and don't do any more invalidations for that area until the window is painted. This reduced the time taken to replace each \r\n with \n\n in very large files by a factor of 3. --- src/Editor.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Editor.h') diff --git a/src/Editor.h b/src/Editor.h index 417700ed5..37df93c93 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -188,6 +188,10 @@ protected: // ScintillaBase subclass needs access to much of Editor Window wMain; ///< The Scintilla parent window Window wMargin; ///< May be separate when using a scroll view for wMain + // Optimization that avoids superfluous invalidations + bool redrawPendingText = false; + bool redrawPendingMargin = false; + /** Style resources may be expensive to allocate so are cached between uses. * When a style attribute is changed, this cache is flushed. */ bool stylesValid; -- cgit v1.2.3