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

Add StringUtil.joining() and use in Element.cssSelectorComponent() #1988

Merged
merged 5 commits into from
Dec 29, 2023

Conversation

Isira-Seneviratne
Copy link
Contributor

Uncomment the stream block in Element and make some improvements to it.

@jhy
Copy link
Owner

jhy commented Nov 27, 2023

While this is a bit neater, I prefer the current version because it recycles in-use StringBuilders, vs allocating a new one every time. As this method gets called via Element#cssSelector() in a loop, that can be a pretty impactful cause of garbage objects.

Perhaps modify the StringUtil to implement a Collectors.joining that uses recycled builders?

# Conflicts:
#	pom.xml
@@ -5,11 +5,14 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change your format settings so that we don't use wildcard imports? Prefer to list them all explicitly.

@jhy jhy added this to the 1.18.1 milestone Dec 29, 2023
@jhy jhy merged commit 38615af into jhy:master Dec 29, 2023
12 checks passed
@jhy jhy changed the title Uncomment stream block in Element Add StringUtil.joining() and use in Element.cssSelectorComponent() Dec 29, 2023
@jhy
Copy link
Owner

jhy commented Dec 29, 2023

Thanks, merged!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants