Inform7 IDE Slow Editing

I can reproduce this with my Cragne Manor contribution code, but not in a new project, so it obviously (and unsurprisingly) is related to source code length.

This is Inform 1.68.1 on Big Sur 11.3.1 on a 2016 MacBook Pro (2,6 GHz Intel Core i7) with 16 GB RAM and Intel HD Graphics 530. Those of you who cannot see this, what are your specs?

EDIT: Another possibly unrelated IDE bug: Clicking the “Restore default settings” button makes Inform beachball indefinitely.

Dabbling around in the profiler, I have a suspicion that the slowdown might be related to the handling of the touch bar:

Towards the bottom of the visible trace, there’s a function labeled -[NSTextView(NSTextView_TouchBar_API) updateTextTouchBarItems], and then heaps more calls related to the touch bar that didn’t fit in the screenshot. Those calls (and indeed the slowdown, for the most part) aren’t happening on my desktop Mac.

So if @zarf was testing on a desktop Mac, or an older MacBook without a touch bar, that might explain why he didn’t experience any slowdown.

As for the underlying problem that causes this… I have no idea.

3 Likes

Good spotting! You are correct; I tried testing on my MPB (with touchbar) and it was very slow. On my desktop iMac it’s fast.

Actually, even with syntax coloring off, editing gets a bit slow with a large source file on the MPB. Not slow enough to impede work, but it’s slower than editing should be.

(I looked around for a large single-file I7 source file for everybody to test with, and came up with http://ifarchive.org/if-archive/games/source/inform/ZorkI7.zip . That’s old I7 code, so it doesn’t compile on 6M62, but it suffices to demonstrate the syntax-coloring problem.)

If you add the lines

- (NSTouchBar *)makeTouchBar {
  return nil;
}

somewhere in IFSourceFileView.m and build Inform from source, the problem goes away.

EDIT: When the project is opened in Xcode, the file is at Inform > Source > Project > IFSourceFileView.m

EDIT 2: The code to disable the touchbar is “borrowed” from Yazmin.

3 Likes

Would it be out of line to put up a fixed unofficial build on Github?

1 Like

That should be fine. I’ll ~create a bug report~ update the existing bug report.

For what it’s worth, I think that the problem is not that the TouchBar call is taking forever. It’s that the whole “display layer” sequence is being called thousands of times per keystroke.

1 Like

Right, there probably is a better fix, then.

Until then, try this and see if it works:

5 Likes

Thanks a lot!
I’m using a Mac with TBar, and the new release worked wonders!
The Dark mode fix is also great as I had already to re-install Inform a couple of times because the preferences fix wasn’t so stable.

2 Likes

Works for me as well. Thanks for doing the detective work and providing an interim fix.

Wes

Thanks! I had been struggling with this issue since I got my new Mac last October. Works very well.

This problem has carried through in the 10.1.2 release of Inform. Can we get a permanent fix?