Open
Conversation
Contributor
|
Interesting, is it much faster than |
Author
|
@ashtuchkin It's faster for internal and single-byte encodings. The use cases are the same as for Buffer.byteLength - if you want to known size of string in bytes before encoding. |
Contributor
|
What is your use case, why do you need that api (vs using encode().length)?
Why do you need these milliseconds? I'm still trying to wrap my head over
why would you need the byte length without the content? You're not
allocating memory for that are you?
I'm wondering why there were no feature requests for that in the past 4
years.. did anything change recently?
I'm in general reluctant to increase the API surface for something that is
a bit faster for a small subset of encodings, so we need to really
understand what that gives us.
…On Jul 10, 2017 4:34 AM, "Dmitriy Tsvettsikh" ***@***.***> wrote:
@ashtuchkin <https://github.com/ashtuchkin> It's faster for internal and
single-byte encodings. The use cases are the same as for Buffer.byteLength
- if you want to known size of string in bytes before encoding.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#158 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAmVHQ1G-FWuVRp1ByOHqhdfKjgdFsK5ks5sMgwygaJpZM4OSOvP>
.
|
84ee650 to
9aa082f
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements
byteLengthmethod. API is the same as in Buffer.byteLength.