You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use onig crate instead of regex crate for strings API. We can't fully replace regex crate as onig doesn't provide a way to match on bytes not it compiles for wasm32 ( it might, but that will be lot of work ).
Suggestion
Use onig for matching on strings ( not on wasm32 target )
Use regex for bytes and strings for wasm32
Pros
onig takes performance from 130ms to 28ms!! It's blazingly fast
Cons
Variance in performance for matching on strings and bytes for API users, because we have no other choice than using regex crate for bytes
Extra dependency
Workaround
We can make a feature called bytes for enabling bytes support, that way users can explicitly opt for adding regex crate as dependency and be aware of slower ( comparatively ) performace.
regex vs onig crate benchmark!
The text was updated successfully, but these errors were encountered:
swanandx
changed the title
use onig crate for string API
use onig crate for matching on strings
Aug 16, 2022
We can use onig crate instead of regex crate for strings API. We can't fully replace regex crate as onig doesn't provide a way to match on bytes not it compiles for wasm32 ( it might, but that will be lot of work ).
Suggestion
onig
for matching on strings ( not on wasm32 target )regex
for bytes and strings for wasm32Pros
onig
takes performance from 130ms to 28ms!! It's blazingly fastCons
Workaround
bytes
for enabling bytes support, that way users can explicitly opt for adding regex crate as dependency and be aware of slower ( comparatively ) performace.regex vs onig crate benchmark!
The text was updated successfully, but these errors were encountered: