seantronsen / pvt

GNU General Public License v3.0
0 stars 0 forks source link

Cache N previous callback results. #21

Closed seantrons closed 7 months ago

seantrons commented 7 months ago

If a callback function receives a set of arguments that was seen in the last N executions (N is programmatically adjustable), we should just return a cached result.

This would be particularly useful for the mandatory callback interface proposed in https://github.com/seantronsen/qtviewer/issues/19 as it would relate to both static and semi-static (views with a small set of known displays) views.

seantronsen commented 7 months ago

So far based on some other topics that I've been reading up on, I know that joblib does have support for memoization and could be used here. We could provide this as an option, disabled by default.

However, there are some issues with this idea:

Yeah, this isn't a big deal and it should ultimately be the responsibility of library users to know details like this, if memoization was implemented. Still, like some other possible features, it's just another detail that can be forgotten and lead to hours of frustration. Plus, there isn't anything stopping users from adding memoization to their own callbacks using the libraries they prefer.

Closing this feature. If anyone has a problem with this in the future, the issue can be re-opened.