Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Conversation

@ingvarc
Copy link
Contributor

@ingvarc ingvarc commented Jun 10, 2018

…r methods

public class Speedtest {

public static void main(String args[]) {
public static void main(String args[]) throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be better to use Java Microbenchmark Harness (JMH) instead. It is used for building, running, and analyzing nano/micro/milli/macro benchmarks and produces reliable results.

# Conflicts: #	java/src/name/fraser/neil/plaintext/diff_match_patch.java
@NeilFraser
Copy link
Contributor

Can you explain why a double-ended queue is superior to a stack? The only operations used are at one end of the data structure, there are no operations at the other end.

@ingvarc
Copy link
Contributor Author

ingvarc commented Jun 19, 2018

@NeilFraser
First of all, we definitely don't want synchronized behavior here as we use it locally to a method.
Moreover, it's sensible in terms of inheritance and the javadoc of Stack says: "A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class". Additionally, the javadoc of ArrayDeque states: "This class is likely to be faster than Stack when used as a stack, ...".
Apart from Stack class itself there is no class in JDK that could represent the stack data structure and the implementations of the Deque interface therefore is considered the best option for stacks.

@NeilFraser
Copy link
Contributor

Understood, makes sense. A side effect of this change is that we'd no longer support Java 5, but I guess that's probably ok these days. I'll revert if we get any complaints.

I'll follow up with another change that mirrors the "lastequality" -> "lastEquality" rename on all the other languages. Keeping cross-language compatibility makes maintaining DMP possible.

@NeilFraser NeilFraser merged commit e6aa1cb into google:master Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants