validator / htmlparser

The Validator.nu HTML parser https://about.validator.nu/htmlparser/
Other
56 stars 26 forks source link

increase bufferSpace by at least 25% #56

Closed MarkusKull closed 3 years ago

MarkusKull commented 3 years ago

to remedy an O(n^2) performance problem when parsing e.g. inline images.

The performance problem is noticeable for e.g. <img src=\"data:image/png;base64,iVBORw0KGgoAAAA... when the image has a size of multiple megabytes. An incremental increase of some KBs each does not help much, thus this PR increases by a proportional factor of 25%.

hsivonen commented 3 years ago

How did you come up with the growth factor (compared to more usual doubling)?

MarkusKull commented 3 years ago

@hsivonen By gut feeling ;) The comments above seemed to emphasize "small" increments, so conventional doubling could be seen as excessive. I did not test multiple factors. Probably any proportional factor is good enough, so you may change it freely.

hsivonen commented 3 years ago

Seems reasonable enough to me. @sideshowbarker ?

sideshowbarker commented 3 years ago

Seems reasonable enough to me. @sideshowbarker ?

Yep, sounds good to me

hsivonen commented 3 years ago

Thanks!