mathiasbynens / mathiasbynens/jsesc
Performance for escaping strings
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 800
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
For escaping strings, jsesc is about 10x slower than js-string-escape:
```
$ time node -e "var escape=require('jsesc'); for (var i = 0; i < 1000000; i++) { escape('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }"
real 0m2.490s
user 0m2.485s
sys 0m0.024s
$ time node -e "var escape=require('js-string-escape'); for (var i = 0; i < 1000000; i++) { escape('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }"
real 0m0.217s
user 0m0.170s
sys 0m0.051s
```
This turns out to be relevant in practice: Building my sample JavaScript app takes twice as long when I use jsesc.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Node.js benchmarks shown in the issue and inspect the jsesc escaping entry point and its existing tests. Compare performance with js-string-escape while preserving jsesc's escaping behavior; done means the reported slowdown is materially reduced and the test suite still passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100