apache / apache/lucene

Review LinkedList usage [LUCENE-6831]

Open
#7,889 2 comments 0 reactions 0 assignees View on GitHub
legacy-jira-fix-version:6.0 legacy-jira-priority:Trivial type:task
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

I quickly scanned the code (out of curiosity) and most of the use cases of LinkedList are as a Queue, in which case indeed an ArrayDeque would be a better choice, especially if the maximum size is known in advance.

There are also some invalid/ incorrect uses like calling size() on a linked list in `MultiPhraseQueryNodeBuilder`, which should be fixed.

---
Migrated from [LUCENE-6831](https://issues.apache.org/jira/browse/LUCENE-6831) by Dawid Weiss (@dweiss), updated Oct 13 2020
Pull requests: https://github.com/apache/lucene-solr/pull/1969, https://github.com/apache/lucene-solr/pull/1969

Contributor guide

Open the contributing guide

Research direction

Start by inventorying LinkedList usages across the Java codebase, then inspect the specifically mentioned MultiPhraseQueryNodeBuilder case. Review each use for queue semantics, known maximum sizes, and inefficient size() calls. Done means the inappropriate usages are identified and corrected, with relevant tests passing; the existing pull request should also be checked before starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.