(repeatCount: number, changeCount: number)
| 11 | ] |
| 12 | |
| 13 | function buildFixture(repeatCount: number, changeCount: number) { |
| 14 | // A large set of changes across random places in the string |
| 15 | let indxes = new Set( |
| 16 | Array.from({ length: changeCount }, () => Math.ceil(Math.random() * repeatCount)), |
| 17 | ) |
| 18 | |
| 19 | let changes: StringChange[] = Array.from(indxes).flatMap((idx) => { |
| 20 | return changesTemplate.map((change) => ({ |
| 21 | start: change.start + strTemplate.length * idx, |
| 22 | end: change.end + strTemplate.length * idx, |
| 23 | before: change.before, |
| 24 | after: change.after, |
| 25 | })) |
| 26 | }) |
| 27 | |
| 28 | return [strTemplate.repeat(repeatCount), changes] as const |
| 29 | } |
| 30 | |
| 31 | let [strS, changesS] = buildFixture(5, 2) |
| 32 | bench('small string', () => { |
no outgoing calls
no test coverage detected
searching dependent graphs…