From 61508c02e7e2ea4de857a2be604e1d80222083c1 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Wed, 21 Dec 2022 08:48:45 +1100 Subject: Bug [#2340]. Avoid repeated call in GetFoldParent for around 10% performance gain with Visual C++ 64-bit release mode on 300,000 line file. Remove duplicated code and simplify. GetFoldLevel and thus GetFoldParent can't throw so mark as noexcept. --- src/Document.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Document.h') diff --git a/src/Document.h b/src/Document.h index 3b0c8ab5a..8d5643e90 100644 --- a/src/Document.h +++ b/src/Document.h @@ -461,10 +461,10 @@ public: int SCI_METHOD SetLevel(Sci_Position line, int level) override; int SCI_METHOD GetLevel(Sci_Position line) const override; - Scintilla::FoldLevel GetFoldLevel(Sci_Position line) const; + Scintilla::FoldLevel GetFoldLevel(Sci_Position line) const noexcept; void ClearLevels(); Sci::Line GetLastChild(Sci::Line lineParent, std::optional level = {}, Sci::Line lastLine = -1); - Sci::Line GetFoldParent(Sci::Line line) const; + Sci::Line GetFoldParent(Sci::Line line) const noexcept; void GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sci::Line line, Sci::Line lastLine); Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const; -- cgit v1.2.3