pinojs / quick-format-unescaped

Solves a problem with util.format
MIT License
17 stars 13 forks source link

Fix missed arguments with %% #12

Closed yaroslav-korotaev closed 6 years ago

yaroslav-korotaev commented 6 years ago

Resolves #11

Please merge it to unescaped version too, for the pino logger

mcollina commented 6 years ago

Can you add a unit test?

yaroslav-korotaev commented 6 years ago

It already here: https://github.com/davidmarkclements/quick-format/blob/4d54320969f45dd7e120cb4787615d9a030667fa/test/index.js#L47

But commented out.

mcollina commented 6 years ago

Can you uncomment it then?

davidmarkclements commented 6 years ago

awesome could you please add a before/after benchmark (as in post results here)

yaroslav-korotaev commented 6 years ago

+-20ms

before:
util*100000: 307.741ms
quickLowres*100000: 364.861ms
quick*100000: 409.436ms
utilWithTailObj*100000: 602.849ms
quickWithTailObjLowres*100000: 396.644ms
quickWithTailObj*100000: 461.702ms
util*100000: 303.272ms
quickLowres*100000: 357.494ms
quick*100000: 396.794ms
utilWithTailObj*100000: 501.232ms
quickWithTailObjLowres*100000: 373.914ms
quickWithTailObj*100000: 438.079ms

after:
util*100000: 322.366ms
quickLowres*100000: 370.941ms
quick*100000: 403.150ms
utilWithTailObj*100000: 596.590ms
quickWithTailObjLowres*100000: 393.269ms
quickWithTailObj*100000: 446.317ms
util*100000: 289.930ms
quickLowres*100000: 355.541ms
quick*100000: 396.102ms
utilWithTailObj*100000: 485.957ms
quickWithTailObjLowres*100000: 377.441ms
quickWithTailObj*100000: 428.785ms
davidmarkclements commented 6 years ago

thank you @yaroslav-korotaev !