This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Introduce OnigString as the underlying caching mechanism #46
Merged
Conversation
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
34 tasks
Looks good to me, thanks! |
zcbenz
added a commit
that referenced
this pull request
Dec 21, 2015
Introduce OnigString as the underlying caching mechanism
Thank you! ❤️ |
59 tasks
@zcbenz Should we publish a new release to npm with this? |
It had been published in 6.0.0. |
Sorry, didn't see an explicit commit with the version bump. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses issue #45
This is quite a huge change and I apologize for that, but IMHO a big refactoring of how caching works was needed.
The change does the following:
OnigCache
,OnigStringContext
andUnicodeUtils
classesOnigString
:OnigScanner::FindNextMatchSync
OnigRegExp
:Search
in aOnigString
Search
result and makes sure it invalidates cached results correctlyOnigString
6.0.0
because caching doesn't come automatically anymore. e.g.:In my opinion the following can be further done to the code-base to take advantage of the major version increment (breaking changes):
FindNextMatch
(not sure if anyone uses the async worker code given the sync path is fast enough now)OnigRegExp
is exposed to JavaScript -- expose it directly and not with aOnigScanner
with exactly oneOnigRegExp
.Added another test case to the benchmarks where the 4th line of jquery.min.js is prefixed with
/*ü*/
(to create a long line that contains multi-byte characters):I have adopted the change in
vscode-textmate
and please notice no perf regressions in the non multi-byte chars case and the perf improvements in the multi-byte chars case:vscode-textmate benchmarks BEFORE
vscode-textmate benchmarks AFTER