FoldingText Slow/CPU Hog


Hey all -

I’ve got a somewhat big FoldingText document for my current project, and it’s starting to become noticeably slower the bigger the file gets. It’s around 150kb with a fair number of todos/headings/syntax-colored-code blocks, etc.

I have a late-model MacbookPro (the Mid 2015 version), and it’s noticeably slow when typing. When typing I notice it taking roughly 50% of my machine’s CPU according to Actiivity Monitor.

(It’s only slow on this large document so I think I may be hitting the limits of what FT is optimized for… I’m trying to avoid the nuclear option of splitting into multiple files since that will kill my current workflow with this document.)

Is there anything that I can do to speed it up? I’ve tried focusing (Control+U) on just the section I’m working on, and that doesn’t seem to help.


It’s hard to say, but I just created a 2.2mb document and editing seemed fast to me. I created my document by just copy/paste a bunch of lines (so very little structure, and no special highlighting). You could try that and see if you still have slow performance (in which case maybe FoldingText’s just slow at that size for you) or if you don’t, then maybe can debug and see what makes it slow.


Thanks for taking a look @jessegrosjean!

I think the issue is lots of code in the document.

  • Here’s an example file. It’s pretty slow to type (especially when hitting enter a number of times) and takes roughly 50% of my CPU while doing so. Scrolling brings CPU up to around 15% I confirmed on an (older, slower) secondary machine too.
  • I thought maybe it was that the code in the blocks was all on a single line, but I added linebreaks in this file and it seems to be the same if not worse.
  • I also tried removing the syntax declaration and it behaves the same.
  • I also tried removing the triple-back-ticks entirely and letting the code appear “bare” in this file and it’s the same story.

These documents are clearly an extreme example at around 350kb apiece with lots of probably-hard-to-parse content.

Not expecting a miracle here just trying to provide a simplified test-case in the hopes that with this info there may be a simple fix.

Or maybe this is a known edge-case of some type that I could work around. If lots of curly brackets or something make the parsing engine go nuts that would be helpful to know, maybe I could offload the curly-bracket-heavy sections elsewhere :slight_smile:

Love FT - keep up the good work! (Wish there were dozens of Jesses and Mutahhirs to build on it full-time!) Hope this helps.


just realized I’m running the dev mode (Version 2.3 Dev (781)) - not sure if that’s relevant - forgot I’d installed it!


Update: I tried with FT 2.2 (Version 2.2 (770)) and it is much snappier. Typing/scrolling/hitting enter a bunch of times never brings CPU above 20% on the example files I posted earlier.

So for now I’ll stick with 2.2 (although I will dearly miss the lovely fenced code block style in 2.3! Hope this “bug report” is helpful in completing 2.3!