Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This particular implementation isn't 400x faster, nor 100x, nor even 10x, nor even 2x. It's about 20% faster, as small benchmarks and overall experimentation shows. E.g., looping a million times with old
Decimal
and newDecimal
(in Crystal):But this is only a silly little benchmark. A simple loop
100000 times: [ ]
in Novika now runs in about 17s instead of 20s, on my machine (Ryzen 3 2200g). The main thing is that we have 0 memory usage at most times now for numbers, while before even in simplest scenarios we had a small, but usage nevertheless.This has almost no effect on the big picture, though. So for now, let this be is on hold, because it introduces complexity and possibility of bugs (the snake fix commit may be a bug in snake, or in the decimal implementation; the fact is that it has to do with random numbers, and there is no sure way to trigger it other than play snake for eternity).
Closes #1