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

benchmark various implementations of Bench.to_seq discussed in #1006 #1010

Merged
merged 1 commit into from
Jan 31, 2021

Conversation

gasche
Copy link
Member

@gasche gasche commented Jan 30, 2021

Results on my machine:

enumeration (89.71 us) is 77.5% faster than
batseq (399.39 us) which is 3.8% faster than
too strict (415.29 us) which is probably (alpha=40.06%) same speed as
simple (416.74 us)
Saving times to times.flat

This suggests that using an enumeration indeed provides a large
performance advantage over the simple approach.

@gasche
Copy link
Member Author

gasche commented Jan 30, 2021

cc @jabot2

…batteries-team#1006

Results on my machine:

    enumeration (89.71 us) is 77.5% faster than
    batseq (399.39 us) which is 3.8% faster than
    too strict (415.29 us) which is probably (alpha=40.06%) same speed as
    simple (416.74 us)
    Saving times to times.flat

This suggests that using an enumeration indeed provides a large
performance advantage over the simple approach.
@jabot2
Copy link
Contributor

jabot2 commented Jan 30, 2021

Looks good

@gasche gasche merged commit f723cff into ocaml-batteries-team:master Jan 31, 2021
@UnixJunkie
Copy link
Member

Does this mean that in general BatEnum is faster than BatSeq ?
I was hoping that BatSeq is at least as fast as Enum.

@gasche
Copy link
Member Author

gasche commented Feb 1, 2021

No, enumeration here is an internal datatype that represents a (pervasive) external iterator, and is then used to implement conversion to both Enum and Seq. I am not sure whether Enum is faster or slower than Seq (I think there are cases where the non-allocating nature of the Enum interface makes is faster), but its implementation is certainly more complex and thus harder to trust.

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.

3 participants