Skip to content

Use faster StringBuilder instead of StringBuffer - #9

Open
alexmojaki wants to merge 1 commit into
jeremyh:masterfrom
alexmojaki:patch-1
Open

Use faster StringBuilder instead of StringBuffer#9
alexmojaki wants to merge 1 commit into
jeremyh:masterfrom
alexmojaki:patch-1

Conversation

@alexmojaki

Copy link
Copy Markdown

From the StringBuffer docs:

As of release JDK 5, this class has been supplemented with an equivalent class designed for use by a single thread, StringBuilder. The StringBuilder class should generally be used in preference to this one, as it supports all of the same operations but it is faster, as it performs no synchronization.

Unless you want to support really old versions of Java or share buffers between threads (neither of which seem to be the case here), use StringBuilder.

From the `StringBuffer` docs:

> As of release JDK 5, this class has been supplemented with an equivalent class designed for use by a single thread, StringBuilder. The StringBuilder class should generally be used in preference to this one, as it supports all of the same operations but it is faster, as it performs no synchronization.

Unless you want to support really old versions of Java or share buffers between threads (neither of which seem to be the case here), use `StringBuilder`.
@davedx

davedx commented Mar 9, 2017

Copy link
Copy Markdown

Do we really want a hash function with an explicit goal of being slow to go faster? :)

@slisznia

slisznia commented Mar 9, 2017 via email

Copy link
Copy Markdown

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.

3 participants