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

Remove a closure in _FieldSet.hashCode #633

Merged
merged 3 commits into from
Apr 26, 2022
Merged

Conversation

osa1
Copy link
Member

@osa1 osa1 commented Apr 25, 2022

Improves HashCode benchmark up to 3%.

JIT before:

HashCode(RunTime): 1981.9821782178217 us.
HashCode(RunTime): 1974.7068114511353 us.
HashCode(RunTime): 1970.9261083743843 us.

JIT after:

HashCode(RunTime): 1899.034155597723 us.
HashCode(RunTime): 1912.0917782026768 us.
HashCode(RunTime): 1908.1782650142993 us.

Native AOT before:

HashCode(RunTime): 5164.038659793814 us.
HashCode(RunTime): 5177.984496124031 us.
HashCode(RunTime): 5192.199481865285 us.

Native AOT after:

HashCode(RunTime): 5027.246231155779 us.
HashCode(RunTime): 5045.488664987405 us.
HashCode(RunTime): 5134.379487179487 us.

JS before:

HashCode(RunTime): 6944.444444444444 us.
HashCode(RunTime): 6913.793103448276 us.
HashCode(RunTime): 6927.335640138408 us.

JS after:

HashCode(RunTime): 6846.41638225256 us.
HashCode(RunTime): 6965.277777777777 us.
HashCode(RunTime): 6920.415224913495 us.

Fixes #632

Improves HashCode benchmark up to 3%.

JIT before:

    HashCode(RunTime): 1981.9821782178217 us.
    HashCode(RunTime): 1974.7068114511353 us.
    HashCode(RunTime): 1970.9261083743843 us.

JIT after:

    HashCode(RunTime): 1899.034155597723 us.
    HashCode(RunTime): 1912.0917782026768 us.
    HashCode(RunTime): 1908.1782650142993 us.

Native AOT before:

    HashCode(RunTime): 5164.038659793814 us.
    HashCode(RunTime): 5177.984496124031 us.
    HashCode(RunTime): 5192.199481865285 us.

Native AOT after:

    HashCode(RunTime): 5027.246231155779 us.
    HashCode(RunTime): 5045.488664987405 us.
    HashCode(RunTime): 5134.379487179487 us.

JS before:

    HashCode(RunTime): 6944.444444444444 us.
    HashCode(RunTime): 6913.793103448276 us.
    HashCode(RunTime): 6927.335640138408 us.

JS after:

    HashCode(RunTime): 6846.41638225256 us.
    HashCode(RunTime): 6965.277777777777 us.
    HashCode(RunTime): 6920.415224913495 us.

Fixes google#632
Copy link
Collaborator

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

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

LGTM

@osa1 osa1 merged commit 1b12ac9 into google:master Apr 26, 2022
@osa1 osa1 deleted the hashCode_closure branch April 26, 2022 07:44
osa1 added a commit to osa1/protobuf.dart that referenced this pull request Apr 26, 2022
@osa1
Copy link
Member Author

osa1 commented May 19, 2022

Ported to internal in cl/449694660.

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.

Optimize GeneratedMessage.hashCode / FieldSet.hashCode - avoid closures, ...
3 participants