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

Extract primitive binary operations from generic derivation #68

Merged
merged 1 commit into from
Jun 14, 2021

Conversation

craigfe
Copy link
Member

@craigfe craigfe commented Jun 11, 2021

This PR is just code movement, in preparation for a follow-up that improves the
implementation of Repr.size_of.

@craigfe
Copy link
Member Author

craigfe commented Jun 11, 2021

I wasn't sure if this code move would be a perf regression due to inlining differences, but it seems not. Taking a random subset of the benchmarks on 4.12+flambda:

/bin/bool/decoder

  major-allocated (words) 1.912643276295168e-08 -> 1.8749617157615887e-08
  minor-allocated (words) 3.000144818917675     -> 3.00014338458947
  monotonic-clock (ns)    14.364530138134555    -> 14.2387131952349

/bin/bool/encoder

  major-allocated (words) 0.00013272412368469736 -> 0.0001325673753334568
  minor-allocated (words) 17.000369171136818     -> 17.000365513605104
  monotonic-clock (ns)    36.614114062016235     -> 36.202986100166434

/bin/int/char (0 <= b <= 7)/decoder

  major-allocated (words) 2.2426733518418638e-08 -> 2.333720880839565e-08
  minor-allocated (words) 3.00015682243577       -> 3.000159975708209
  monotonic-clock (ns)    15.490271721869108     -> 15.827316030885317

/bin/int/char (0 <= b <= 7)/encoder

  major-allocated (words) 0.00011094330024032022 -> 0.00011439560427351727
  minor-allocated (words) 13.988809511338692     -> 14.000392920751212
  monotonic-clock (ns)    46.64706870512427      -> 45.84583076612596

/bin/triple_short_int/decoder

  major-allocated (words) 0.0003661506530433007 -> 0.0003661506530433007
  minor-allocated (words) 16.00026315715933     -> 16.00026315715933
  monotonic-clock (ns)    26.0765536583521      -> 25.954999735241444

/bin/triple_short_int/encoder

  major-allocated (words) 0.00047488916106462863 -> 0.00047772855653753846
  minor-allocated (words) 20.001231993250016     -> 20.001244328326532
  monotonic-clock (ns)    121.5038156944062      -> 123.64678945748766

/bin/variant/decoder

  major-allocated (words) 0.00022407974378948177 -> 0.0002068110465555966
  minor-allocated (words) 22.350997232953027     -> 22.323529632453084
  monotonic-clock (ns)    37.476367788729206     -> 38.48230385789799

/bin/variant/encoder

  major-allocated (words) 0.001118561664162485 -> 0.0011464753845754887
  minor-allocated (words) 31.659976389036725   -> 31.671412651120534
  monotonic-clock (ns)    89.58312741177834    -> 94.87063236576186

These differences look to be within measurement noise to me.

Copy link
Contributor

@mattiasdrp mattiasdrp left a comment

Choose a reason for hiding this comment

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

Love this PR, the code looks so much cleaner, thanks!

@mattiasdrp
Copy link
Contributor

Let's merge this fast to reduce the noise for the important PR ;-)

@craigfe craigfe merged commit 3f5dd7c into mirage:main Jun 14, 2021
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