diff --git a/NvimView/Sources/NvimView/NvimView+Draw.swift b/NvimView/Sources/NvimView/NvimView+Draw.swift index 126e8594..2d86be13 100644 --- a/NvimView/Sources/NvimView/NvimView+Draw.swift +++ b/NvimView/Sources/NvimView/NvimView+Draw.swift @@ -222,8 +222,7 @@ extension NvimView { columnRange: ClosedRange ) -> [AttributesRun] { rowRange.map { row in - self.ugrid.cells[row][columnRange] - .groupedRanges(with: { cell in cell.attrId }) + groupedRanges(of: self.ugrid.cells[row][columnRange]) .compactMap { range in let cells = self.ugrid.cells[row][range] @@ -273,3 +272,38 @@ private let infoTextAttrs = [ ] private let colorSpace = NSColorSpace.sRGB + +/// When we use the following private function instead of the public extension function in +/// Commons.FoundationCommons.swift.groupedRanges(with:), then, according to Instruments +/// the percentage of the function is reduced from ~ 15% to 0%. +/// Keep the logic in sync with Commons.FoundationCommons.swift.groupedRanges(with:). Tests are +/// present in Commons lib. +private func groupedRanges(of cells: ArraySlice) -> [ClosedRange] { + if cells.isEmpty { return [] } + if cells.count == 1 { return [cells.startIndex...cells.startIndex] } + + var result = [ClosedRange]() + result.reserveCapacity(cells.count / 2) + + let inclusiveEndIndex = cells.endIndex - 1 + var lastStartIndex = cells.startIndex + var lastEndIndex = cells.startIndex + var lastMarker = cells.first!.attrId // cells is not empty! + for i in cells.startIndex..CFBundlePackageType APPL CFBundleShortVersionString - 0.42.1 + 0.42.2 CFBundleSignature ???? CFBundleURLTypes @@ -1241,7 +1241,7 @@ CFBundleVersion - 20220910.153746 + 20220913.230838 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/VimR/VimRTests/Info.plist b/VimR/VimRTests/Info.plist index 873086d2..90332d44 100644 --- a/VimR/VimRTests/Info.plist +++ b/VimR/VimRTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.42.1 + 0.42.2 CFBundleSignature ???? CFBundleVersion - 20220910.153746 + 20220913.230838 diff --git a/appcast.xml b/appcast.xml index 081fe4fa..cf706a8f 100644 --- a/appcast.xml +++ b/appcast.xml @@ -6,22 +6,22 @@ Most recent changes with links to updates for VimR. en - v0.42.1-20220910.153746 + v0.42.2-20220913.230838 https://twitter.com/vimrefined - 20220910.153746 - v0.42.1 + 20220913.230838 + v0.42.2 -
  • Bugfix: Memory leak (custom tabs).
  • +
  • Improve rendering performance.
  • ]]>
    - https://github.com/qvacua/vimr/releases/tag/v0.42.1-20220910.153746 + https://github.com/qvacua/vimr/releases/tag/v0.42.2-20220913.230838 - 2022-09-10T15:46:20.838961 + 2022-09-13T23:18:03.725690 10.13.0 -
    diff --git a/appcast_snapshot.xml b/appcast_snapshot.xml index 081fe4fa..cf706a8f 100644 --- a/appcast_snapshot.xml +++ b/appcast_snapshot.xml @@ -6,22 +6,22 @@ Most recent changes with links to updates for VimR. en - v0.42.1-20220910.153746 + v0.42.2-20220913.230838 https://twitter.com/vimrefined - 20220910.153746 - v0.42.1 + 20220913.230838 + v0.42.2 -
  • Bugfix: Memory leak (custom tabs).
  • +
  • Improve rendering performance.
  • ]]>
    - https://github.com/qvacua/vimr/releases/tag/v0.42.1-20220910.153746 + https://github.com/qvacua/vimr/releases/tag/v0.42.2-20220913.230838 - 2022-09-10T15:46:20.838961 + 2022-09-13T23:18:03.725690 10.13.0 -
    diff --git a/resources/release-notes.md b/resources/release-notes.md index 88a6cb2e..c222f2c2 100644 --- a/resources/release-notes.md +++ b/resources/release-notes.md @@ -1,5 +1,13 @@ # Next +* ... + +# 0.42.2-20220913.230838 + +* Improve rendering performance. + +# 0.42.1-20220910.153746 + * Bugfix: Memory leak (custom tabs). # 0.42.0-20220703.104316