-
Notifications
You must be signed in to change notification settings - Fork 1
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
Memoize result for a given input #19
Comments
This works for most cases, but not all. For example, it doesn't work for search engine prompts: we fetch the suggestions from the remove server, and these can change any moment. So memoizing search engine suggestions is quite misleading. What I'd have is memoizing the results for the prompts that have a constant (= non-lambda) constructor. That should be pretty safe, because the only thing that can break in such a case is a pre/post-processor. But it's quite hard to conjure such a pre/post-processor that would break things, so we're safe. Still, I'm not sure about this one. |
The constructor is run only once during the prompter life-time ;) Here I'm suggesting to memoize Now what about side effects? As far as I'm aware, no Nyxt prompt has any. Thoughts? |
Yeah, boolean toggle is the best solution here. But I'm somewhat cautious about setting it to T by default—seems like a potential foot-shooting behavior. I mean, in case of Nyxt we can add a proxy source class with |
Fair enough, it's super easy to subclass |
A great optimization, I believe, would be to memoize the source
update
results depending on the input.Example:
With the current
prompter
, the last "foo" would take another 10s. With memoization, it would be instantaneous.In terms of memory, I don't believe it's a big deal since prompters are short-lived objects.
The text was updated successfully, but these errors were encountered: