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

Actually don't check SingletonList as comment says. #1132

Merged
merged 3 commits into from
Apr 1, 2020

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Mar 31, 2020

Noticed implementation does not reflect the comment "Faster to make a copy than check the type to see if it is already a singleton list". I haven't actually benchmarked this but it seems to make sense. Alternatively I can revert the code changes and remove the comment, let me know.

Additionally optimizes for an empty mutable list parameter.

// avoid copying datastructure by trusting certain names.
String simpleName = extra.getClass().getSimpleName();
return simpleName.equals("SingletonList")
Copy link
Member

Choose a reason for hiding this comment

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

that SingletonList isn't here hurts my brain because it is a well known type. that said I understand why you are doing this.. it is under the assumption nothing else is using this method which is fair enough. It might hurt brain less to say intentionally not checking SingletonList due as the only call site wont' have it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, added a comment both for that and because I realized the empty list check was similarly redundant.

@codefromthecrypt codefromthecrypt merged commit 8772a96 into openzipkin:master Apr 1, 2020
@codefromthecrypt
Copy link
Member

thanks!

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