Open haesleinhuepf opened 4 years ago
Agree! I haven't personally hit that wall (yet), but can I see that becoming an issue at some point. Did you stumble upon a working example?
Additional functions usually see little change on a regular basis, so polling them on each call is definitely overkill (although they can be updated on the fly).
Perhaps checking (and/or logging) for changes and keeping a cached list might be an alternative, though I'd have to take a closer look into the source. It's been a while since my last dive.
Cheers! Nico
Did you stumble upon a working example?
Yes! I should have provided it in the first place. The issue happened while having this in the additional macro functions: https://gist.github.com/haesleinhuepf/d530cc035819656276b03e6cadfc063b
If you have time to take a closer look, cool! Otherwise I'll dive into it later. Again, no hurry!
Thanks!
Cheers, Robert
Dear @ndefrancesco, dear future-self,
it might be a special case and I guess there is no hurry in fixing this: if there are some hundred functions in
IJ1Helper.getAdditionalMacroFunctions();
the auto-completion pull down becomes laggy and actually hinders typing. I assume the same happens if macros are thousands of lines long.At least for the case of
getAdditionalMacroFunctions
I can see a way out: We cache the pulldown content. As long as the return value ofIJ1Helper.getAdditionalMacroFunctions()
doesn't change, we don't need to regenerate it.Here might be a starting point:
https://github.com/imagej/imagej-legacy/blob/master/src/main/java/net/imagej/legacy/plugin/MacroAutoCompletionProvider.java#L341
Furthermore, we should ensure that the pulldown opens after e.g. < 500 ms in all cases. Therefore we might explore how to interrupt its content generation.
Cheers, Robert