Skip to content

Conversation

@Nodonisko
Copy link
Contributor

I had to refactor hex utils one more time because some validation function were also very slow. It looks that superstruct is more than 5x slower for simple RegExp validation. Even with native RegExp it still not fast enough so I also added memoizations.

Screenshot 2025-07-01 at 15 26 00

@Nodonisko Nodonisko force-pushed the chore/faster-hex-validation branch 2 times, most recently from 998f99a to 3606596 Compare July 1, 2025 14:33
@Mrtenz Mrtenz merged commit 900aae0 into MetaMask:main Jul 2, 2025
21 of 22 checks passed
cryptodev-2s pushed a commit to MetaMask/core that referenced this pull request Jul 3, 2025
## Explanation

Address formatting and validation is used all across the app but these
functions are not performant enough for mobile app se we need to use
faster + memoized versions in order to improve mobile app performance.
There shou

## References

This PR needs to wait until MetaMask/utils#248
is merged and released.

## Changelog

<!--
THIS SECTION IS NO LONGER NEEDED.

The process for updating changelogs has changed. Please consult the
"Updating changelogs" section of the Contributing doc for more.
-->

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Charly Chevalier <charlyy.chevalier@gmail.com>
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