TobyLobster / Inform

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

Inform7 IDE Slow Editing #28

Closed wmodes closed 1 year ago

wmodes commented 2 years ago

I originally reported this issue back in Jan 2021 with Inform7 v1.68.1. I downloaded the most recent build of v10.1.2 and was surprised to see it was still an issue (original report here)

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.

Screen Recording Slow Inform7 IDE

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.

And the details of my version of Inform:

Download file: inform_10_1_2_macOS_1_82_3.dmg Inform version: 1.82 (1.82.3) OS: MacOS Montereey v12.6 (21G115)

But this also happens with earlier versions of Inform, such as I7-6M62-OSX.dmg. In the earlier investigation, there was some suspicion that it might be related to the touch bar handling.

Unfortunately, this makes the IDE unusable.

Thanks for any leads to fixing this.

TobyLobster commented 2 years ago

I don't have a fix for this issue yet, but you might like to know about a possible workaround in v10.1.2:

  1. In Preferences->Editing, turn off 'Enable Styles'
  2. In Preferences->Colour, turn off 'Enable Colouring'

Obviously this turns off all the syntax highlighting so this is not a great solution. But I hope the text editing speed should be more acceptable.

angstsmurf commented 2 years ago

Also, if you build the Inform IDE from the source yourself, this hack (disabling the touch bar) still works: https://intfiction.org/t/inform7-ide-slow-editing/49086/24

wmodes commented 2 years ago

I wondered if that hack still works. I've never built Inform from source and found Tony's instructions. Unfortunately, it skips over the entire code build which I've never done. Anyone have any pointers to completing that build?

wmodes commented 2 years ago

Well, I figured it out, but that didn't go well.

'interp_z3.h' file not found in interp.c:

#ifdef HAVE_COMPUTED_GOTOS
# define TABLES_ONLY
# include "interp_z3.h"
# include "interp_z4.h"
# include "interp_z5.h"
# include "interp_z6.h"
# undef TABLES_ONLY
TobyLobster commented 2 years ago

If you are willing to experiment a little:

Try unzipping the enclosed file in the 'zoom/build' directory (make the 'build' directory if you don't have it) and try building the Inform App in Xcode again.

zoom_build.zip

wmodes commented 2 years ago

Well, I was willing to experiment. Thanks @TobyLobster for the pre-build zoom files. I tried variations on signing the source as Mac Developer, Apple Developer, and Sign to Run Locally because I didn't have an Apple Developer ID. All happily build (via Archive) successfully. However, the Inform.app seemed to quietly crash.

I tried going into Inform.app/Contents/MacOS and running Inform directly. I got:

MacOS % ./Inform
dyld[30694]: Library not loaded: '@rpath/GlkSound.framework/Versions/A/GlkSound'
  Referenced from: '/Applications/Inform.app/Contents/MacOS/Inform'
  Reason: tried: '/usr/lib/swift/GlkSound.framework/Versions/A/GlkSound' (no such file), '/Applications/Inform.app/Contents/MacOS/../Frameworks/GlkSound.framework/Versions/A/GlkSound' (code signature in <D3B99BC3-7415-383A-9666-C3FA969A61DF> '/Applications/Inform.app/Contents/Frameworks/GlkSound.framework/Versions/A/GlkSound' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/usr/lib/swift/GlkSound.framework/Versions/A/GlkSound' (no such file), '/Applications/Inform.app/Contents/MacOS/../Frameworks/GlkSound.framework/Versions/A/GlkSound' (code signature in <D3B99BC3-7415-383A-9666-C3FA969A61DF> '/Applications/Inform.app/Contents/Frameworks/GlkSound.framework/Versions/A/GlkSound' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/System/Library/Frameworks/GlkSound.framework/Versions/A/GlkSound' (no such file)
[1]    30694 abort      ./Inform

Looks like GlkSound didn't build?

Sad face. This is new territory, so apologies for what are probably noob errors.

TobyLobster commented 2 years ago

It's a signing issue. From the output you quote: "GlkSound' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)". Sorry, I think you need an Apple Developer ID.

When I have time, I'll have to try the hack suggested above. If it works I'll get a new version out.

wmodes commented 1 year ago

@TonyLobster, it seemed your --local param in config.py didn't do anything.

I thought it would be useful to have a --local param that set CODE_SIGN_IDENTITY to - which is apparently xcode's designation for "Sign to Run Locally"

When I configured the build with Sign to Run Locally and with my Developer Team ID (retrieved from my keychain), I no longer had the signing issue. However, I had another problem (below). Here's the modified configure.py

configure.py.zip

wmodes commented 1 year ago

Okay, when I ran the inform.app here's what I got (partial):

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/GlkSound.framework/Versions/A/GlkSound'
Referenced from: '/Applications/Inform.app/Contents/MacOS/Inform'
Reason: tried: '' (no such file), '' (code signature in <D3B99BC3-7415-383A-9666-C3FA969A61DF> '' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '' (no such file), '' (code signature in <D3B99BC3-7415-383A-9666-C3FA969A61DF> '' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adh
(terminated at launch; ignore backtrace)

So interestingly, GlkSound still had a signing issue.

wmodes commented 1 year ago

Interestingly, when i sign with my Developer Team ID using the --develop flag, the build fails at the last step trying to sign the inform.app with the following:

CodeSign /Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/InstallationBuildProductsLocation/Applications/Inform.app (in target 'Inform' from project 'Inform')
    cd /Users/wmodes/dev/inform-build/Inform/inform

    Signing Identity:     "Apple Development: wmodes@gmail.com (WXH9UQURVG)"

    /usr/bin/codesign --force --sign D8C39DC04CC612A0B96F106603CA717C5D93F01C -o runtime --entitlements /Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/IntermediateBuildFilesPath/Inform.build/Release/Inform.build/Inform.app.xcent --generate-entitlement-der /Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/InstallationBuildProductsLocation/Applications/Inform.app

/Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/InstallationBuildProductsLocation/Applications/Inform.app: code object is not signed at all
In subcomponent: /Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/InstallationBuildProductsLocation/Applications/Inform.app/Contents/MacOS/6M62/ni
Command CodeSign failed with a nonzero exit code

Experimenting on the command line, I get the same error with the codesign command, but the --deep command line option works. But it feels a little hacky.

wmodes commented 1 year ago

Further experimentation...

Once I signed the inform.app with the --deep command line option, I could actually run Inform for the first time from a build. Copying it from this obscure xcode location (/Users/wmodes/Library/Developer/Xcode/DerivedData/Inform-gzkwiqfmupwuzfcumalzutqxrtdm/Build/Intermediates.noindex/ArchiveIntermediates/Inform/InstallationBuildProductsLocation/Applications/Inform.app) to my apps directory, I was good to go.

So this indicates a couple things:

I haven't tested yet whether this solves the original problem of the slow text using the zoom header files you passed me.

Testing....

Turns out, nope.

Oh wait, I haven't done this little tidbit from Petter Sjölund yet:

If you add the lines

- (NSTouchBar *)makeTouchBar {
  return nil;
}

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

Now when I rebuild...

IT WORKS. Daaaanm, thanks. This is the first time I've been able to work on my project in months.

TobyLobster commented 1 year ago

I'm so glad you got up and running, that's good to hear! I'll put out a new version when I get a moment. Busy on other things right now, but soon (crosses fingers).

wmodes commented 1 year ago

I would be glad to see this as part of the release.

TobyLobster commented 1 year ago

This should be fixed now.