-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimise ChainId epoch format parsing
from_string checks if argument is in epoch format and then calls chain_version which does it again. chain_version and with_version use regex to check if string is in epoch format and then not only parse the string again but unnecessarily collect dash-separated parts into a new vector. Optimise it by providing split_chain_id method which checks the format and returns individual name and version parts of the id if it is in epoch format. Furthermore, don’t use regex which is a heavy machinery for simply checking if string ends in a positive integer.
- Loading branch information
Showing
1 changed file
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters