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

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new c2832e1e7e Improve performance logging hot path, fixes #7823 (#7824)
c2832e1e7e is described below

commit c2832e1e7e8b9842c068d1710ff560e9d3c8b130
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Aug 7 11:11:41 2026 +0200

    Improve performance logging hot path, fixes #7823 (#7824)
---
 .../org/apache/hop/core/config/plugin/ConfigFile.java  | 18 ++++++++++++++++--
 .../java/org/apache/hop/core/logging/LogMessage.java   |  2 +-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git 
a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java 
b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java
index 00c81905c6..b42bd6963e 100644
--- a/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java
+++ b/core/src/main/java/org/apache/hop/core/config/plugin/ConfigFile.java
@@ -91,7 +91,7 @@ public abstract class ConfigFile implements IConfigFile {
   public ConfigFile(String filename, List<DescribedVariable> 
describedVariables) {
     this();
     setConfigFilename(filename);
-    configMap.put(HOP_VARIABLES_KEY, describedVariables);
+    setDescribedVariables(describedVariables);
   }
 
   @JsonIgnore
@@ -105,6 +105,16 @@ public abstract class ConfigFile implements IConfigFile {
     }
 
     Object variablesObject = configMap.get(HOP_VARIABLES_KEY);
+
+    // The list is stored back below, so from the second call onwards it 
already holds
+    // DescribedVariable objects. Serialising those to JSON only to parse them 
straight back would
+    // be pure overhead, and this method sits on the path of every single log 
message.
+    //
+    if (variablesObject instanceof List<?> describedList
+        && (describedList.isEmpty() || describedList.get(0) instanceof 
DescribedVariable)) {
+      return (List<DescribedVariable>) variablesObject;
+    }
+
     if (variablesObject != null) {
       try {
         for (Object dvObject : (List) variablesObject) {
@@ -165,6 +175,10 @@ public abstract class ConfigFile implements IConfigFile {
 
   @Override
   public void setDescribedVariables(List<DescribedVariable> 
describedVariables) {
-    configMap.put(HOP_VARIABLES_KEY, describedVariables);
+    // Kept mutable: getDescribedVariables() hands this very list out and 
setDescribedVariable()
+    // adds to it.
+    configMap.put(
+        HOP_VARIABLES_KEY,
+        describedVariables == null ? new ArrayList<>() : new 
ArrayList<>(describedVariables));
   }
 }
diff --git a/core/src/main/java/org/apache/hop/core/logging/LogMessage.java 
b/core/src/main/java/org/apache/hop/core/logging/LogMessage.java
index e4852d45e7..d4689ef9ab 100644
--- a/core/src/main/java/org/apache/hop/core/logging/LogMessage.java
+++ b/core/src/main/java/org/apache/hop/core/logging/LogMessage.java
@@ -72,7 +72,7 @@ public class LogMessage implements ILogMessage {
     ILoggingObject loggingObject = 
LoggingRegistry.getInstance().getLoggingObject(logChannelId);
 
     boolean detailedLogTurnOn =
-        "Y".equals(HopConfig.readStringVariable(Const.HOP_LOG_MARK_MAPPINGS, 
"N")) ? true : false;
+        "Y".equals(HopConfig.readStringVariable(Const.HOP_LOG_MARK_MAPPINGS, 
"N"));
     if (loggingObject != null) {
       if (!detailedLogTurnOn) {
         subject = loggingObject.getObjectName();

Reply via email to