TobyLobster / Inform

Inform is a design system for interactive fiction based on natural language
Other
83 stars 18 forks source link

Inform7 IDE Slow Editing on MacOS Catalina #9

Closed wmodes closed 1 year ago

wmodes commented 3 years ago

I'm editing a larger file in the Inform7 IDE and am experiencing very slow editing. I've searched and found no one else reporting this. I can edit small files with no lag, but large files present a huge lag as I type. Compiling happens at normal speed. Attached is a link to a video of me typing far ahead of the buffer.

https://drive.google.com/file/d/1JwRLdLLq1advkmNKAOCrEDUCQP441SR8/view?usp=sharing

Here are the deets of my file:

The 33597-word source text has successfully been translated into a world with 41 rooms and 184 things, and the index has been brought up to date.

Happy to provide source file to test on your inform version.

And the details of my version of Inform:

Download file: I7-6M62-OSX-Interim.dmg Inform version: 1.68.1 OS: MacOS Catalina

But this also happens with earlier versions of Inform, such as I7-6M62-OSX.dmg

Thanks for any leads to fixing this.

wmodes commented 3 years ago

I thought it might be a large block of ChangeLog notes that I kept in comment form in the file, but it wasn't that. I also thought I might have a tricky hanging bracket or quote that was making the file difficult, but it appears not.

It also appears to not be purely an issue of length, as I pasted in half of the text of Pride and Prejudice and noted only a small slow down. With the entire book, typing was considerably slower.

It appears that there are processes that happen after every keystroke whose rapidity is affected by the length/complexity of the text. That might be worth looking at, changing to a less frequent update, or only after a user has stopped typing for a period.

Would it help to try my source file?

erkyrath commented 3 years ago

We noted on the forum that this only happens when syntax coloring is turned on.

Further profiling (thanks ArdiMaster, https://intfiction.org/t/inform7-ide-slow-editing/49086/22 ) indicates that a whole lot of time is spent in updateTextTouchBarItems. The problem is only observable on MacBook Pros with touchbar.

See screenshot:

a7242fb4e8ce58920a7bae20d66e83478ba475dd_2_1380x862

erkyrath commented 3 years ago

I'm pretty sure that the real problem is that when syntax coloring is on, the view's redisplay method is being called thousands of times per keystroke. The touchbar call itself is only marginally slow (a few milliseconds), but because it's called way too often, it beats the CPU to death.

weaversam8 commented 3 years ago

For additional feedback, I'm running "Version 1.68 (1.68.1)" on Big Sur (11.6) on an M1 Mac Mini and also encountering slow editing. My device doesn't have a touchbar, but there are still large lags on every keystroke, even on small files like the Onyx example.

TobyLobster commented 2 years ago

For a possible workaround in the latest version v1.82 (v10.1.2), see https://github.com/TobyLobster/Inform/issues/28#issuecomment-1257520463

TobyLobster commented 1 year ago

This should be fixed now.