totalcross icon indicating copy to clipboard operation
totalcross copied to clipboard

Memoization

Open flsobral opened this issue 4 years ago • 0 comments

In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Wikipedia

  • [x] Hard coded results for fibR inside executeMethod
  • [ ] Replace the hard coded results with an actual cache for the method fibR (the method being optimized is still hard coded and we'll only be supporting a single 64-bit argument)
  • [ ] Expand implementation to handle methods used in more "real life" examples and perform tests to evaluate the performance we get in more realistic scenarios. One suggestion is for using Math trigonometry methods like sin, cos, tan, asin, acos, atan and atan2, and perform tests drawing circles and stuff.
  • [ ] Expand cache to handle a method that returns a 32 bit value (like int)
  • [ ] Find out how to detect the return value and use the appropriate detour with XSELECT
  • [ ] Add support for arguments with a 32 bit value (like int)
  • [ ] Create a new annotation for methods that may be memoized by the VM, which would just set a flag, nothing fancy
  • [ ] Change the VM to look for methods flagged for memoization instead of using hard coded method names (please notice we are only actually optimising methods which accept a single argument and both the argument and the return value must be either 32 or 64 bit values)
  • [ ] Expand support for methods with N arguments
  • [ ] Replace the annotation with automatic detection of memoizable methods

flsobral avatar Feb 03 '21 17:02 flsobral