mbien commented on code in PR #277:
URL: https://github.com/apache/maven-indexer/pull/277#discussion_r1032837361
##
indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java:
##
@@ -277,17 +277,17 @@ private IndexWriter tempWriter( final String name )
throws IOException
}
private void addToIndex( final Document doc, final IndexingContext
context, final IndexWriter indexWriter,
- final ConcurrentMap rootGroups,
- final ConcurrentMap allGroups )
+ final Set rootGroups,
+ final Set allGroups )
throws IOException
{
ArtifactInfo ai = IndexUtils.constructArtifactInfo( doc, context );
if ( ai != null )
{
indexWriter.addDocument( IndexUtils.updateDocument( doc, context,
false, ai ) );
-rootGroups.putIfAbsent( ai.getRootGroup(), Boolean.TRUE );
-allGroups.putIfAbsent( ai.getGroupId(), Boolean.TRUE );
+rootGroups.add( ai.getRootGroup() );
+allGroups.add( ai.getGroupId() );
Review Comment:
`add` should be a little bit faster compared to `putIfAbsent` in the
concurrent case. But since so much IO is going on it goes down in the noise.
##
indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java:
##
@@ -165,8 +165,8 @@ private IndexDataReadResult readIndexMT( IndexWriter w,
IndexingContext context
final Document theEnd = new Document();
-ConcurrentMap rootGroups = new ConcurrentHashMap<>();
-ConcurrentMap allGroups = new ConcurrentHashMap<>();
+Set rootGroups = ConcurrentHashMap.newKeySet();
+Set allGroups = ConcurrentHashMap.newKeySet();
Review Comment:
I tried to size them appropriately (central has about 70k groups, and
resizing CHMs has a larger impact than normal maps), but since this made no
performance difference I left the defaults as is.
--
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: issues-unsubscr...@maven.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org