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

nth is slow #75

Closed
skx opened this issue Nov 1, 2022 · 0 comments · Fixed by #76
Closed

nth is slow #75

skx opened this issue Nov 1, 2022 · 0 comments · Fixed by #76

Comments

@skx
Copy link
Owner

skx commented Nov 1, 2022

The sorting.lisp example does some stuff:

  • Create a list of random numbers
  • Sort them
    • First of all with insertion-sort
    • Then with quick-sort
    • Finally with the golang sort
  • Finally iterate over the results and make sure the results match

However the last step is incomplete - we generate a list of 512 integers, however we only test the first 20 or so results. While that's probably indicative of success it isn't sufficient to prove it.

The reason we don't test all the numbers is because the operation of (nth) is so. damn. slow.

nth could be moved to golang, to make it super-fast, or it could be improved in other ways. Decide, and do the necessary.

skx added a commit that referenced this issue Nov 2, 2022
(nth ..) is slow, very slow, due to its recursive nature.  However
working with lisps and using nth is common, so it makes sense to
move the implementation from lisp into the golang core.

This closes #75
@skx skx closed this as completed in #76 Nov 2, 2022
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 a pull request may close this issue.

1 participant