Skip to content

Not as fast on Macs #2

@bengl

Description

@bengl

As first reported by @zkat, and verified by others, it looks like the final number on the benchmark, referring to the primed-cache speed of qdd, seems to be not significantly better on Macs. While I'm getting times of 0.5s on my machine (Linux), Mac users seem to be getting closer to 4s or 5s.

I collected .cpuprofile data from my machine and a Mac, and found that around 80% of the time on Macs is being spend in (idle), leading me to believe it's simply waiting on filesystem operations the whole time. On Linux the (idle) time is closer to 20%-25%, so while this might not account for all of the overhead, it at least accounts for a really huge chunk of it.

Since almost all of that operation consists of a recursive copy, I modified that file to use standard fs module operations (the qdd version calls the binding directly), and also added perf_hooks marks to see which of the filesystem calls were taking up the most time. The resulting script is in this gist, which can be run from any arbitrary empty directory. The test downloads a tarball, unpacks it, and measures the time to copy recursively from one directory to another. In qdd these operations happen many, many times in parallel.

Here are the results (time in ms):

My Arch Linux Lenovo X1 Carbon (from 2016):

$ node copytest.js 
readdir 1.995347
stat 16.328005827783088
mkdir 7.106336499999999
copyfile 15.482173730219255
---
77.179121

A Google Compute Cloud instance (TODO put specs in here):

$ node copytest.js 
readdir 1.7026445
stat 14.900154024738319
mkdir 9.860568500000001
copyfile 15.350753629170656
---
71.24901

A macincloud.com Pay-as-you-Go instance (OS X High Sierra):

$ node copytest.js 
readdir 4.9309635
stat 83.9008870846811
mkdir 38.07782
copyfile 78.84369494852221
---
353.116088

While this is still pretty inconclusive, fs.stat and fs.copyFile seem to be taking considerably longer on a Mac than on Linux. In all tests, node@8.9.4 is used. For both my machine and the Google instance, the filesystem is ext4 and for the Mac it's HFS+.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions