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

Use memoization #1

Closed
alexpovel opened this issue May 21, 2023 · 0 comments · Fixed by #23 or #28
Closed

Use memoization #1

alexpovel opened this issue May 21, 2023 · 0 comments · Fixed by #23 or #28
Labels
enhancement New feature or request

Comments

@alexpovel
Copy link
Owner

When running on large inputs, certain words will be highly common. Memoize those, like @cache in Python.

See also alexpovel/betterletter#33 .

@alexpovel alexpovel added the enhancement New feature or request label May 21, 2023
alexpovel added a commit that referenced this issue May 24, 2023
Not providing benchmarks for this, as:

- there's a new approach to `is_valid`. It's still recursive, but now
  such that *not* using memoization would yield exponentially exploding
  runtimes (as these functions call each other a lot, with highly
  repetitive inputs; the upside is that the code reads really nicely).
  Much like a naive Fibonacci implementation. As such, memoization is
  now *required* and leaving it out would simply show abysmal
  performance in benchmarks.

  THAT SAID, performance is still strongly improved (probably), as a
  vital hot-loop part *is* memoized after all.
- I can't be bothered this time around

Closes #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant