You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/16 01:18:37 UTC

[james-project] 07/11: [PERF] ResultUtils::haveValidContent should avoid stream operation

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9b91068643a16edea62da7807848d2b65d23837c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 11 09:19:35 2022 +0700

    [PERF] ResultUtils::haveValidContent should avoid stream operation
    
    Streams can be costly and sonarlint proposed me an equivalent refactoring
    relying only on native methods...
    
    2.5% of FETCH time was spent in this method...
---
 .../src/main/java/org/apache/james/mailbox/store/ResultUtils.java     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java
index 2066469..db7bf04 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java
@@ -117,9 +117,7 @@ public class ResultUtils {
 
     @VisibleForTesting
     static boolean haveValidContent(FetchGroup fetchGroup) {
-        return fetchGroup.profiles()
-            .stream()
-            .allMatch(SUPPORTED_GROUPS::contains);
+        return SUPPORTED_GROUPS.containsAll(fetchGroup.profiles());
     }
 
     private static void addPartContent(FetchGroup fetchGroup, MailboxMessage message, MessageResultImpl messageResult)

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org