Hey Chris,
There was a LOT of text in that topic! I didn't read it all in detail, but did look through it.
Posting the macros I was working on wouldn't help. There was nothing special about them apart from the fact that the editor was lagging when I edited them. Although I should write a macro to save a macro, delete it, then read it back in. (There will be a BIG "O caveat emptor!" sign on that one. )
Following the previous discussion, my first thought was images in the KM database. I often give macros custom icons, typically to match the icons that I use to launch macros from TouchPortal. So the first thing that I tried was saving a copy of the database, then going through and removing most of the icon images. This reduced the size of the file substantially (a few MB). But when I again tried to edit the macro in question the problem remained.
Conclusion: At least in this single instance, the problem was not using custom icon images.
Then I reloaded the larger database containing the images. The problem persisted. (Conclusion: Saving and restoring the entire database didn't fix the problem with the editor lagging.)
But when I saved, deleted, and reloaded just that macro the problem went away.
While I don't have any particular insight into exactly how the editor code works, I'm not surprised at the outcome. The kmsync file is actually a binary property list file. Since it is being updated with every keystroke, I suspect that the internal structure of the file can get pretty convoluted as a large macro is edited again and again. Saving then rereading a macro might effectively "defragment" that part of the database by writing out a serialized version of the data then bringing it back in as an ordered, contiguous chunk. That should greatly simplify the bookkeeping needed to handle the next keystroke while editing.
Presumably copying then reloading the entire database doesn't fix the problem because the proper list file is read back in in its previous fragmented form.
Perhaps the right macro to write would:
- Save the entire library for safety sake
- Go through and save/delete every macro
- Go back and reread all of those macros
- Clean up after itself
I did notice the post about real-time evaluation in the KM Editor. That is an option that I probably would not use. (What can I say? I'm sloppy enough that I benefit from a guard rail against things like typos in variable names or calculations.) If my experience to date generalizes that might obviate the need for the change.
I hope you've had a great holiday. Happy New Year!
-Jeff