performance question :)
- Dominant language
- TypeScript
- Stars
- 50.3k
- Forks
- 2.7k
- Avg merge
- 2h 40m
- Merged PRs (30d)
- 69
Description
running the loop below to pack each of 100k random ASCII-only sentences into a random width of 50-250px, i get ~2200ms. have not tested it for accuracy yet.
```js
console.time('pretext 100k');
const opts = { whiteSpace: 'pre-wrap' };
for (let i = 0; i < strings.length; i++) {
let text = strings[i];
if (text.length > 0) {
const prepared = prepare(text, 'Inter', opts);
const { height, lineCount } = layout(prepared, randInt(50, 250), 20);
}
}
console.timeEnd('pretext 100k');
```
wondering if this is the correct/optimal usage. i have a 2kb lib that does the same loop accurately in ~80ms.
looking forward to the various optimization PRs in this repo, too!
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported loop using 100k random ASCII-only sentences, random widths of 50–250px, and the shown prepare/layout calls. Compare its timing and accuracy with the referenced 2KB library, then establish whether the current usage is correct and what measurable optimization would count as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100