Hi there!
I noticed that on My Surface Pro 9, Windows 11, Anki Version 25.09.2, launching the editor is really slow. I tried a few different things like turning on different power plans, setting anki/python process as high, but it it still takes roughly 1 second for the window to be drawn, and another ~.5-1 second for the content to be visible to the user. This did persist, even using a ‘basic’ card with a few words on the back/front. While 1.5-2 seconds isn’t much for opening up the editor, it does add up overtime.
I wrote a python add on (with help from AI) to cache the editor on startup (see here: https://ankiweb.net/shared/info/2101230922). It reuses/hides the editor box it is dismissed, and closes it when the application shuts down. A simple Autohotkey script showed that the editor is only able to open/close about 8-10 times in 10 seconds, but the text still doesn’t render between opens, meaning it’s even slower. With the add on, it is opening 28 times in ten seconds and the text is rendered each time. The editor now opens very quickly - set_note() on a the cached webview instance is ~40ms, but EditCurrent.__init__() + webview init is ~700ms.
Looking at the _init_.py DialogManager.open, it does look like this “Fast Path/reopen” already does exist in the code - maybe it’s a bug?
def open(self, name, \*args, \*\*kwargs):
(creator, instance) = self.\_dialogs\[name\]
if instance:
instance.reopen(\*args, \*\*kwargs) # fast path — already exists
else:
instance = creator(\*args, \*\*kwargs) # slow path — creates new
self.\_dialogs\[name\]\[1\] = instance
Because closeEvent always calls cleanup(), markClosed(“EditCurrent”) is always set to None, so every open goes through the slow path:
editcurrent.py line 63-67
def cleanup(self) → None:
gui_hooks.operation_did_execute.remove(self.on_operation_did_execute)
self.editor.cleanup()
saveGeom(self, “editcurrent”)
aqt.dialogs.markClosed(“EditCurrent”) # ← sets instance to None
def closeEvent(self, evt):
self.editor.call_after_note_saved(self.cleanup) # ← always calls cleanup
Just thought I would bring this up. I had wondered if I should suggest this to be added to Anki overall, but it seems like that may have already been the original intent.