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 45
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
thanks for the @hokein's effort. The test has an excessive long line. Making this benchmark fast will result faster parsing for some real-world peculiar files.
For the record: This aims to improve the situation around atom/atom#979 |
It hits the API incompatibility between node versions :-/ Looking... |
bool HasMultibyteCharacters() const; | ||
const char* utf8_value() const { return *utf8Value; } | ||
size_t utf8_length() const { return utf8Value.length(); } | ||
const wchar_t* utf16_value() const { return reinterpret_cast<const wchar_t*>(*utf16Value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since utf16_value
is only used on Windows, I think we can only define it on Windows too, in case we accidentally used utf16_value
on POSIX in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Updated this PR to ifdef utf16 bits out.
OnigStringContext is an immutable object that encapsulates various values which are derived from a v8String, including a UTF8 copy, a UTF16 copy and a predicate. OnigStringContext can be used as a cache of these values to save extra computation like string copying and memory allocation when the same V8 string is given to FindNextMatchSync() in subsequent calls. Speedup: * large.js sync: 482ms -> 366ms * large.js async: 5914ms -> 4971ms (These numbers are noisy) * oneline sync: 66624ms -> 1085ms * oneline async: N/A (took too long) Although there are some rooms for improvement in the async case, this overall seems good starting point to address slow-long-line problem, where we've repeatedly allocated the long string.
This PR is awesome, thanks! |
zcbenz
added a commit
that referenced
this pull request
Mar 23, 2015
Eliminating some extra string copies
[email protected] has been published. |
\o/ |
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.
Oops, I accidentally closed #27 so re-opening this...
@zcbenz WDYT?