K0K0V0K commented on code in PR #4655:
URL: https://github.com/apache/hadoop/pull/4655#discussion_r985825269


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ConfigurationProperties.java:
##########
@@ -55,6 +59,17 @@ public ConfigurationProperties(Map<String, String> props) {
     storePropertiesInPrefixNodes(props);
   }
 
+  /**
+   * A constructor defined in order to conform to the type used by
+   * {@code Configuration}. It must only be called by String keys and values.
+   * @param props properties to store
+   * @param whiteListPrefix only those properties will be in the nodes
+   *                        which starts with one of the provided prefixes.
+   */
+  public ConfigurationProperties(Map<String, String> props, String... 
whiteListPrefix) {
+    this(Maps.filterKeys(props, key -> StringUtils.startsWithAny(key, 
whiteListPrefix)));

Review Comment:
   Thanks for the review @9uapaw and sorry for the late response



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ConfigurationProperties.java:
##########
@@ -55,6 +59,17 @@ public ConfigurationProperties(Map<String, String> props) {
     storePropertiesInPrefixNodes(props);
   }
 
+  /**
+   * A constructor defined in order to conform to the type used by
+   * {@code Configuration}. It must only be called by String keys and values.
+   * @param props properties to store
+   * @param whiteListPrefix only those properties will be in the nodes
+   *                        which starts with one of the provided prefixes.
+   */
+  public ConfigurationProperties(Map<String, String> props, String... 
whiteListPrefix) {
+    this(Maps.filterKeys(props, key -> StringUtils.startsWithAny(key, 
whiteListPrefix)));

Review Comment:
   Thanks for the review @9uapaw and sorry for the late response
   I dont think the lambda has performance issue here. I created a small perf 
test to prove it, and based on it the vanilia solution is way slower than 
guava. I suggest the Hashmap.put() method requires some mem allocation time 
when the map reach the limit.
   
   
[benchmark_code.txt](https://github.com/apache/hadoop/files/9698166/benchmark_code.txt)
   
[benchmark_log.txt](https://github.com/apache/hadoop/files/9698167/benchmark_log.txt)
   



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to