Skip to content

Conversation

@Hy60koshk
Copy link
Contributor

  • Alike Array.sort(), the function now modifies the array in place. It won't be StalinSort enough, if you'd be able to bring those values back.

  • Sped it up. The previous version had reallocation issues, which not only were slower themself, but also led to speed losses on arrays with lots of values in the resulting array (e.g. when values are already sorted or nearly-sorted, or when there are lots of duplicates). Now it only truncates the array once. Speed gain is 2 to hundreds times, depending on the input array values, since the new algo executes in close to only length-dependent time.

- Alike Array.sort(), it is now modifies the array in place. It won't be StalinSort enough, if you'd be able to bring those values back.

- Sped it up. The previous version had reallocation issues, which not only were slower themself, but also led to speed losses on arrays with lots of duplicates. Now it only truncates the array once. Speed gain is 2 to hundreds times, depending on the input data, since the original algo was data-sensitive, while the new algo executes in close to only length-dependent time.
@gustavo-depaula
Copy link
Owner

Hi! Thanks for your PR and sorry for the delay reviewing it.

We favor having multiple implementations instead of overwriting the existing ones, can you move your implementation to a new file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants