Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replaces ArrayList by HashSet to increase the performance #114

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

Closed
Deipher wants to merge 1 commit into SQiShER:master from Deipher:master
Closed

Replaces ArrayList by HashSet to increase the performance #114

Deipher wants to merge 1 commit into SQiShER:master from Deipher:master

Conversation

@Deipher
Copy link
Contributor

@Deipher Deipher commented Oct 28, 2014

The removeAll() will use the contain method.
HashSet has a more efficient implementation of contains than ArrayList.

Tell me what do you think of these changes :)

The removeAll() will use the contain method.
HashSet has a more efficient implementation of contains than ArrayList.
Copy link
Owner

SQiShER commented Oct 29, 2014

I agree that contains() of HashSet is more efficient than the one of LinkedList and ArrayList. But unfortunately it has the negative side effect of preventing the presence of multiple equal items in the same collection. Although multi-occurrence is not yet properly implemented, that's something I want the library to fully support someday. So I don't think a generic utility function like filteredCopyOf should make any limiting assumptions about the nature of the collections it is applied to.

If this really takes a big hit on the performance, I could imagine some kind of type checking to properly adapt to Set and List types and choose an appropriate implementation. But even this adds some complexity I'd like to avoid.

Come to think of it, I think that sooner or later there should be special Differ implementations for HashSet, TreeSet, LinkedList, etc., which can properly cater to the special characteristics of the underlying collection types. This would render the collection utilities more or less obsolete (or at least use them in a less generic way.)

So for now I would rather not merge this pull request. Sorry. I hope that's okay for you. If this takes a huge performance hit in your use-case, let me know. Maybe we are able to find some other ways to speed it up.

Copy link
Contributor Author

Deipher commented Oct 30, 2014

Sure i am open to discussion and indeed your are right concerning the
negative side effect. I will also rollback my changes :)

2014年10月29日 23:59 GMT+01:00 Daniel Bechler notifications@github.com:

I agree that contains() of HashSet is more efficient than the one of
LinkedList and ArrayList. But unfortunately it has the negative side
effect of preventing the presence of multiple equal items in the same
collection. Although multi-occurrence is not yet properly implemented,
that's something I want the library to fully support someday. So I don't
think a generic utility function like filteredCopyOf should make any
limiting assumptions about the nature of the collections it is applied to.

If this really takes a big hit on the performance, I could imagine some
kind of type checking to properly adapt to Set and List types and choose
an appropriate implementation. But even this adds some complexity I'd like
to avoid.

Come to think of it, I think that sooner or later there should be special
Differ implementations for HashSet, TreeSet, LinkedList, etc., which can
properly cater to the special characteristics of the underlying collection
types. This would render the collection utilities more or less obsolete (or
at least use them in a less generic way.)

So for now I would rather not merge this pull request. Sorry. I hope
that's okay for you. If this takes a huge performance hit in your use-case,
let me know. Maybe we are able to find some other ways to speed it up.


Reply to this email directly or view it on GitHub
#114 (comment)
.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /