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.
.apply cant be inlined - we're doing format.apply all the time
the thing is, we actually only ever need it if the first param is attempting interpolation,
however using regexp to test whether a string contains '%' is just as expensive as just doing the format.apply.
But - we can check if args length > 1 (instead of greater than 0), and then prioritise the 0 case by simply setting message to params[0]. This gives a 5-10% perf increase, bringing 10000 ops down to 260-265ms
benchmarks:
results at 10000 ops:
benchPino_10000: 319.005ms
benchPino2_10000: 268.181ms
benchPinoMultiArg_10000: 297.216ms
benchPino2MultiArg_10000: 283.411ms
benchPino_10000: 290.877ms
benchPino2_10000: 259.626ms
benchPinoMultiArg_10000: 295.353ms
benchPino2MultiArg_10000: 282.366ms
results at 50000 ops
benchPino_50000: 1334.496ms
benchPino2_50000: 1269.305ms
benchPinoMultiArg_50000: 1342.086ms
benchPino2MultiArg_50000: 1345.085ms
benchPino_50000: 1312.044ms
benchPino2_50000: 1269.279ms
benchPinoMultiArg_50000: 1343.235ms
benchPino2MultiArg_50000: 1354.008ms
full benchmark results:
benchBunyan_10000: 1075.649ms
benchWinston_10000: 1840.185ms
benchBole_10000: 1635.768ms
benchPino_10000: 265.838ms
benchBunyanObj_10000: 1250.343ms
benchWinstonObj_10000: 1828.912ms
benchPinoObj_10000: 357.569ms
benchBoleObj_10000: 1594.823ms
benchBunyan_10000: 1082.447ms
benchWinston_10000: 1717.277ms
benchBole_10000: 1591.113ms
benchPino_10000: 260.141ms
benchBunyanObj_10000: 1231.469ms
benchWinstonObj_10000: 1807.529ms
benchPinoObj_10000: 385.072ms
benchBoleObj_10000: 1542.180ms