Closed hekike closed 5 years ago
Calling sprintf is expensive, do not call when zero arguments are passed. In some scenarios, an application needs to create hundreds of VError(s).
sprintf
To test the change's effect:
for(var i = 0; i < 10000; i++) { new mod_verror.VError('Foo') }
On my 2017 MBP 3.5Ghz, I see a 27% performance improvement after the change.
Before:
https://github.com/joyent/node-verror/issues/63 https://cr.joyent.us/#/c/5299/
Calling
sprintf
is expensive, do not call when zero arguments are passed. In some scenarios, an application needs to create hundreds of VError(s).To test the change's effect:
On my 2017 MBP 3.5Ghz, I see a 27% performance improvement after the change.
Before: