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

Improve performance of some predicator functions #36

Merged
merged 5 commits into from
Aug 26, 2023

Conversation

lambdalisue
Copy link
Member

No description provided.

The benchmark result of the previous implementation is 197.12 ns/iter
but the new implementation is 88.99 ns/iter.
Before to this commit, the benchmark result was

  is.ObjectOf                   335.74 ns/iter   2,978,453.8 (307.15 ns … 694.14 ns) 337.23 ns 391.01 ns 694.14 ns
  is.ObjectOf (strict)          406.31 ns/iter   2,461,182.4  (386.4 ns … 453.27 ns) 413.72 ns 442.96 ns 453.27 ns
  is.ObjectOf (pre)             179.34 ns/iter   5,575,896.2   (167.5 ns … 196.1 ns) 185.86 ns 195.85 ns 195.88 ns
  is.ObjectOf (pre, strict)     205.37 ns/iter   4,869,263.2 (199.38 ns … 225.96 ns) 207.86 ns 224.33 ns 225.62 ns

And after this commit

  is.ObjectOf                   150.21 ns/iter   6,657,313.1 (144.75 ns … 161.07 ns) 152.62 ns 159.53 ns 160.82 ns
  is.ObjectOf (strict)          240.33 ns/iter   4,160,893.5 (233.04 ns … 276.14 ns) 241.96 ns 273.35 ns 273.55 ns
  is.ObjectOf (pre)              112.1 ns/iter   8,920,598.1 (108.72 ns … 124.09 ns) 112.92 ns 118.22 ns 122.38 ns
  is.ObjectOf (pre, strict)     137.05 ns/iter   7,296,588.7 (130.81 ns … 168.84 ns) 139.82 ns 151.59 ns 158.23 ns
Before this commit, the benchmark result was

  is.OptionalOf                 243.37 ns/iter   4,108,906.6  (234.5 ns … 271.25 ns) 245.73 ns 264.14 ns 267.17 ns
  is.OptionalOf (pre)           200.66 ns/iter   4,983,517.6 (195.82 ns … 232.95 ns) 202.55 ns 215.28 ns 222.94 ns

And after this commit

  is.OptionalOf                  45.56 ns/iter  21,948,235.7   (41.91 ns … 72.25 ns)  48.58 ns  53.75 ns  56.55 ns
  is.OptionalOf (pre)            12.86 ns/iter  77,733,516.2    (12.7 ns … 20.59 ns)  12.86 ns  14.23 ns  14.64 ns
@lambdalisue lambdalisue merged commit 2e392ad into main Aug 26, 2023
4 checks passed
@lambdalisue lambdalisue deleted the improve-performance branch August 26, 2023 14:26
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.

1 participant