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

Generate Float and Double via division #118

Merged
merged 2 commits into from
May 5, 2020

Conversation

curiousleo
Copy link
Collaborator

@curiousleo curiousleo commented Apr 29, 2020

Coverage

Before:

0.787% of representable Floats in the unit interval reached

After:

7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

For the full analysis, see #105.

Performance

Before:

pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )

This is simply a Pareto-improvement over what we currently have. #102 is related but separate, since it changes the coverage completely but at the cost of decreased performance.

Coverage
========

Before:

    0.787% of representable Floats in the unit interval reached

After:

    7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

Performance
===========

Before:

    pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
    pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

    pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
    pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

    pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
    pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

    pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
    pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )
@curiousleo curiousleo merged commit f05c2a7 into interface-to-performance May 5, 2020
@curiousleo curiousleo deleted the fp-by-division branch May 5, 2020 09:23
curiousleo added a commit that referenced this pull request May 13, 2020
* Generate Float and Double via division

Coverage
========

Before:

    0.787% of representable Floats in the unit interval reached

After:

    7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

Performance
===========

Before:

    pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
    pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

    pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
    pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

    pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
    pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

    pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
    pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )

* Floating point ranges inclusive in upper bound
curiousleo added a commit that referenced this pull request May 13, 2020
* Generate Float and Double via division

Coverage
========

Before:

    0.787% of representable Floats in the unit interval reached

After:

    7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

Performance
===========

Before:

    pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
    pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

    pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
    pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

    pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
    pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

    pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
    pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )

* Floating point ranges inclusive in upper bound
lehins pushed a commit that referenced this pull request May 18, 2020
* Generate Float and Double via division

Coverage
========

Before:

    0.787% of representable Floats in the unit interval reached

After:

    7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

Performance
===========

Before:

    pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
    pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

    pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
    pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

    pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
    pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

    pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
    pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )

* Floating point ranges inclusive in upper bound
curiousleo added a commit that referenced this pull request May 19, 2020
* Generate Float and Double via division

Coverage
========

Before:

    0.787% of representable Floats in the unit interval reached

After:

    7.874% of representable Floats in the unit interval reached

(A similar enumeration for Double is impossible, but it is very likely
that coverage is increased for Doubles too.)

Performance
===========

Before:

    pure/random/Float                        mean 331.1 μs  ( +- 21.67 μs  )
    pure/uniformR/unbounded/Float            mean 324.6 μs  ( +- 2.849 μs  )

    pure/random/Double                       mean 411.3 μs  ( +- 5.876 μs  )
    pure/uniformR/unbounded/Double           mean 416.8 μs  ( +- 41.93 μs  )

After:

    pure/random/Float                        mean 27.32 μs  ( +- 158.0 ns  )
    pure/uniformR/unbounded/Float            mean 27.37 μs  ( +- 422.0 ns  )

    pure/random/Double                       mean 27.34 μs  ( +- 303.1 ns  )
    pure/uniformR/unbounded/Double           mean 27.49 μs  ( +- 983.7 ns  )

* Floating point ranges inclusive in upper bound
Shimuuar pushed a commit to Shimuuar/random that referenced this pull request Jan 6, 2025
…hortbytestring-fixup

Improve uniform ShortByteString (fixup)
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