Skip to content

Commit 6130158

Browse files
Copilotnixel2007
andcommitted
Extract parallel processing threshold to named constant
Replace magic number 1000 with PARALLEL_PROCESSING_THRESHOLD constant for better maintainability. Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
1 parent f6f8d01 commit 6130158

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
@RequiredArgsConstructor
6969
public class SemanticTokensProvider {
7070

71+
/**
72+
* Порог количества токенов, при превышении которого используется параллельная обработка.
73+
*/
74+
private static final int PARALLEL_PROCESSING_THRESHOLD = 1000;
75+
7176
@SuppressWarnings("NullAway.Init")
7277
private ExecutorService executorService;
7378

@@ -213,7 +218,9 @@ private static List<SemanticTokenEntry> filterTokensByRange(List<SemanticTokenEn
213218
int endChar = range.getEnd().getCharacter();
214219

215220
// Use parallel stream for large collections to leverage multiple cores
216-
var stream = entries.size() > 1000 ? entries.parallelStream() : entries.stream();
221+
var stream = entries.size() > PARALLEL_PROCESSING_THRESHOLD
222+
? entries.parallelStream()
223+
: entries.stream();
217224

218225
return stream
219226
// Quick line-based pre-filter (simple integer comparison)

0 commit comments

Comments
 (0)