jhy/jsoup — Issue #143: Easy feature request: Allow for smaller buffer in Node#outerHtml()
Author: gnikolaidis
Created: 2011-11-25 18:11:44+00:00
State: open

First of all: well done to jsoup developers. The code is super-clean and works wonderfully!

Public method Node#outerHtml() constructs a 32KB buffer in 1.6.1. This is excessive for use case scenarios like ours: we are constructing small HTML fragments in memory and serializing them immediately. Output size is known to not exceed 100 or 200 characters most of the time.

Node#outerHtml(StringBuilder accum) is not public. Calling Element#html() - which doesn't preallocate memory - on a temporary outer node seems to be the only workaround solution right now.

A fix should be simple. Thank you!

George Nikolaidis / Ergobyte (www.ergobyte.gr)