Alexandr Kravchuk
|
42f350494b
|
perf: optimize stringReplaceAll and add template literal fast path
- Improved stringReplaceAll efficiency by pre-computing replacement string
and better loop structure
- Added fast path for template literals in createBuilder to avoid slow
.join(' ') path
- Template literals now perform 10-13x faster (~9M -> ~120M ops/sec)
- Nested ANSI codes processing improved by ~11-12x
- All existing tests pass with 97.95% coverage maintained
Performance improvements:
- Template literals: +1289% (9M -> 127M ops/sec)
- Nested styles: +1156% (9M -> 113M ops/sec)
- Regular calls: +200% (39M -> 120M ops/sec)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-03-17 12:08:10 +01: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 |
|