-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reflect/protoreflect: optimize Name.IsValid and FullName.IsValid
For simplicity, IsValid was implemented in terms of regular expressions, which are useful for verifying a string according to a strict grammar, but performs poorly. Implement the check in terms of hand-written code, which provides a 20x improvement to validate the name "google.protobuf.Any". name old time/op new time/op delta FullNameIsValid-8 683ns ± 2% 35ns ± 1% -94.86% (p=0.000 n=10+10) Change-Id: I980403befca0b72cea22acd274064a46cb02644b Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/238002 Reviewed-by: Damien Neil <dneil@google.com>
- Loading branch information
Showing
2 changed files
with
46 additions
and
12 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
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