Ink: Poor performance when printing a lot of lines to a `<Static>` element

Created on 25 Jun 2019  路  4Comments  路  Source: vadimdemedes/ink

See https://github.com/tapjs/node-tap/issues/574

When using the specy reporter in node-tap, the performance falls off as more lines are added to the <Static> element.

It looks like <Static> is getting the newChildren list by converting the list of children to an array (a full scan) and then filtering it (another scan) by checking if it's included in the previously rendered set (another scan!) That's O(n^3) if I'm understanding the logic correctly.

It could probably keep a pointer to the next element that needs to be rendered (or even delete children once they're rendered?)

enhancement

Most helpful comment

Fixed via https://github.com/vadimdemedes/ink/commit/78be775973ac234b0ae5e2e65c662fd0297eb038, released in 2.3.0. Thanks for reporting, @isaacs!

All 4 comments

Interesting idea about the pointer, I will see what can be done!

Fixed via https://github.com/vadimdemedes/ink/commit/78be775973ac234b0ae5e2e65c662fd0297eb038, released in 2.3.0. Thanks for reporting, @isaacs!

That was fast! I'll pull your update pr and see if it solves the issue. Thanks!

Yeah, that made all of tap's ink-based reporters noticeably faster. Shipped in 14.3.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zkat picture zkat  路  7Comments

nmehta6 picture nmehta6  路  3Comments

zkat picture zkat  路  7Comments

colinking picture colinking  路  6Comments

naholyr picture naholyr  路  3Comments