krickert commented on code in PR #1086:
URL: https://github.com/apache/opennlp/pull/1086#discussion_r3434431333
##########
opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java:
##########
@@ -144,246 +152,334 @@ private static InferenceOptions
validateConstructorArguments(
@Override
public Span[] find(String[] input) {
- final List<Span> spans = new LinkedList<>();
+ final List<Span> spans = new ArrayList<>();
Review Comment:
Yes - `ArrayList` is the better fit here. Decoding threads a search cursor
by reading the last emitted span via `decoded.get(decoded.size() - 1)`, which
is O(1) on `ArrayList` vs O(n) on `LinkedList`, and the list is consumed with
`toArray(...)`. There's no head/middle insertion or removal that would favor
`LinkedList`. (`tokenize()` still uses `LinkedList` as before.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]