Skip to content

Conversation

@liangjh98
Copy link
Contributor

Optimize LogCollectUtils

public class LogCollectUtils {

private static final List<String> BINARY_TYPE_LIST = Arrays.asList("image", "multipart", "cbor",
private static final Set<String> BINARY_TYPE_LIST = Sets.newHashSet("image", "multipart", "cbor",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Set data structure has a time complexity of O(1) for element lookup, while List has O(n). Since the code frequently checks whether contentType.getType() and contentType.getSubtype() exist in BINARY_TYPE_LIST, using Set can significantly improve performance.

@Aias00 Aias00 merged commit 2a4a7fb into apache:master Sep 28, 2025
42 checks passed
@Aias00
Copy link
Contributor

Aias00 commented Sep 28, 2025

hi, add my wechat pls: aias00

@Aias00 Aias00 added this to the 2.7.0.3 milestone Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants