abhu85
73b11b92a8
perf: optimize 2-argument case with direct concatenation
...
For the common 2-argument case (e.g., `chalk.red('Error:', message)`),
use direct string concatenation instead of `join(' ')`.
This optimization provides a significant speedup for 2-argument calls:
- Old: `arguments_.join(' ')` - requires array iteration and method dispatch
- New: `arguments_[0] + ' ' + arguments_[1]` - V8 primitive op, JIT-inlined
Benchmark results show ~14x speedup for the isolated string concatenation
operation in the 2-argument case.
Fixes #669
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:13:13 +00:00
Sindre Sorhus
fa16f4ec37
Require Node.js 12 and move to ESM
2021-04-16 16:22:53 +07:00
Toon Baeyens
72299f99a0
remove fixed number of iterations ( #406 )
2020-11-20 15:26:28 +01:00
Toon Baeyens
09ddbadcb5
Support template literals for nested calls ( #392 )
...
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
2020-06-09 15:36:34 +08:00
Yanis Benson
c08417e88c
Improve performance greatly ( #337 )
2019-07-12 13:40:23 +07:00
Sindre Sorhus
0307f263cb
Require Node.js 6
2018-09-18 14:32:14 +07:00
Sindre Sorhus
249b9ac7e7
ES2015ify the codebase
2017-06-20 19:21:14 +02:00
Sindre Sorhus
409f95eef5
add XO
...
https://github.com/sindresorhus/xo
2015-08-20 03:05:43 +07:00
Sean McArthur
42918337e5
return a new function for each getter
...
- defines the getters onto a proto
- the function returned has its __proto__ set to our proto
fixes #32
2014-07-09 10:54:59 -07:00
Sindre Sorhus
3ab833de62
bench - increase iterations for more reliable results
2014-07-04 22:32:23 +02:00
Sindre Sorhus
d255f42a9e
bench - minor code style tweaks
2014-07-04 22:29:02 +02:00
Joshua Appelman
3026d71e0e
Adds benchmarking using matcha.
...
Run through:
```shell
./node_modules/matcha/bin/matcha benchmark.js
```
Results against current HEAD:
```shell
1,863,195 op/s » add colour
2,215,812 op/s » add several styles
323,213 op/s » add nested styles
```
Results against the latest revision before optiziations, e122899
```shell
26,714 op/s » add colour
26,752 op/s » add several styles
13,414 op/s » add nested styles
```
Closes #21
2014-07-04 21:30:02 +02:00