Skip to content

Buffer performance degradation in 6.6.0 #8733

@CurryKitten

Description

@CurryKitten

When comparing 6.6.0 against 6.5.0 using one of our benchmarks, we’ve noticed that there’s a performance degradation in the buffer code. We’re running a benchmark that creates a new buffer from an array as many times as it can over a given period of time, for example -

var ARRAY = [1, 2, 23829, 4, 5, 7, 12312321, 2131, 434832, 43792, 23421, 65345, 132210, 77777, 322131, 1, 2, 23829, 4, 5, 7, 12312321, 2131, 434832, 43792, 23421, 65345, 132210, 77777, 322131, 1, 2, 23829, 4, 5, 7, 12312321, 2131, 434832, 43792, 23421, 65345, 132210, 77777, 322131, 1, 2, 23829, 4, 5, 7, 12312321, 2131, 434832, 43792, 23421, 65345, 132210, 77777, 322131];
var ITERATIONS = 300000;
var result;

function test() {
        for(var i=0;i<ITERATIONS;i++) {
                result = new Buffer(ARRAY);
        }
}

On 6.6.0 there an approx 10% slowdown over 6.5.0. Been working through the likely reasons with @gareth-ellis and found that this appears to have been caused by PR #8453 where in buffer.js instances of

if (value instanceof ArrayBuffer)

have been changed to

if (isArrayBuffer(value))

We saw this regression on Linux PPC64, however, if we back this change out of 6.6.0 and rebuild on both Linux PPC64 and Linux Intel, then we see a performance increase, suggesting that the change is having an adverse affect on buffer performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.performanceIssues and PRs related to the performance of Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions