Example code - memoization: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

17 June 2024

  • curprev 11:0511:05, 17 June 2024WikiSysop talk contribs 3,051 bytes +585 No edit summary
  • curprev 10:5010:50, 17 June 2024WikiSysop talk contribs 2,466 bytes +2,466 Created page with "Memoization is an optimization technique, which remembers the result of CPU/time expensive function calls.<br> It is an example of the Golden Rule: Do not repeat work that has already been done.<br> You can also call the method for "caching of results". <pre> #!/usr/bin/env python3 # Demo of the effectivenes of caching import time class Compute: # Class variable used for caching cache = dict() def __init__(self, computeDelay): # Instance variab..."