Skip to content

String fixes - #30

Merged
fanatid merged 3 commits into
masterfrom
strfix
Apr 28, 2017
Merged

fanatid merged 3 commits into
masterfrom
strfix

Conversation

@dcousens

@dcousens dcousens commented Apr 28, 2017

Copy link
Copy Markdown
Contributor

~40% increase in performance when encoding somewhat simple objects

@dcousens dcousens added the bug label Apr 28, 2017
@dcousens
dcousens requested a review from fanatid April 28, 2017 13:29
Comment thread lib/varstring.js
var varbuffer = VarBuffer(lengthType)
var bufferCodec = VarBuffer(lengthType)
if (!encoding) encoding = 'utf8'
if (!Buffer.isEncoding(encoding)) throw new TypeError('invalid encoding')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this is not a breaking change, this is a fix

Comment thread lib/varstring.js
},
encodingLength: function encodingLength (value) {
if (typeof value !== 'string') throw new TypeError('value must be a string')
return varbuffer.encodingLength(Buffer.from(value, encoding))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my profiler indicated this as the largest performance issue in one of my applications...

@fanatid
fanatid merged commit 9443134 into master Apr 28, 2017
@fanatid
fanatid deleted the strfix branch April 28, 2017 16:21
@dcousens dcousens mentioned this pull request May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants