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

Rework reverse #1242

Merged
merged 1 commit into from
Aug 6, 2023
Merged

Rework reverse #1242

merged 1 commit into from
Aug 6, 2023

Conversation

primo-ppcg
Copy link
Contributor

@primo-ppcg primo-ppcg commented Aug 6, 2023

Similar to the changes in #1241. The result is approximately twice as fast on any size argument.

(use spork/test)

(def a (range 10))
(def b (range 100))
(def c (range 1000))

(timeit-loop [:timeout 1] :a (reverse a))
(timeit-loop [:timeout 1] :b (reverse b))
(timeit-loop [:timeout 1] :c (reverse c))

master:

a 1.000s, 0.4635µs/body
b 1.000s, 3.296µs/body
c 1.000s, 31.49µs/body

branch:

a 1.000s, 0.2932µs/body
b 1.000s, 1.939µs/body
c 1.000s, 17.52µs/body

I try not to have more than one open PR at a time, but I thought I might slip these in before the release.

@sogaiu
Copy link
Contributor

sogaiu commented Aug 6, 2023

master (ecc4d80):

$ janet reverse.janet 
a 1.000s, 0.5987µs/body
b 1.000s, 4.195µs/body
c 1.000s, 37.62µs/body

branch (c8c0e11):

$ JANET_PATH=$HOME/.local/lib/janet ~/src/janet.primo-ppcg/build/janet reverse.janet 
a 1.000s, 0.4237µs/body
b 1.000s, 2.636µs/body
c 1.000s, 24.57µs/body

Also tested against some repositories with no issues 👍

Copy link
Member

@pepe pepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bakpakin bakpakin merged commit 0ea1da8 into janet-lang:master Aug 6, 2023
8 checks passed
@primo-ppcg primo-ppcg deleted the reverse branch August 6, 2023 13:23
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.

4 participants