Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inefficient internal content(Element) method #151

Open
lukaseder opened this issue Nov 22, 2017 · 0 comments
Open

Inefficient internal content(Element) method #151

lukaseder opened this issue Nov 22, 2017 · 0 comments

Comments

@lukaseder
Copy link
Member

There's an internal content(Element) method with a TODO that does not yet have an issue associated with it:

// TODO: Check this code's efficiency
String name = element.getTagName();
return Util.toString(element).replaceAll("(?s)^<" + name + "(?:[^>]*)>(.*)</" + name + ">$", "$1");

This is very obviously inefficient. We cannot cache the regular expression, but we can traverse the string without resorting to regexes, as the regex logic is rather simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant