Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-completion becomes laggy in case of massive macro code length #249

Open
haesleinhuepf opened this issue Sep 20, 2020 · 2 comments
Open

Comments

@haesleinhuepf
Copy link
Member

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 of IJ1Helper.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

@ndefrancesco
Copy link
Contributor

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

@haesleinhuepf
Copy link
Member Author

haesleinhuepf commented Sep 22, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants