Allon Mureinik has uploaded a new change for review.

Change subject: core: optimize setVdsGroupCompatibilityVersion
......................................................................

core: optimize setVdsGroupCompatibilityVersion

VDS and VM methods setVdsGroupCompatibilityVersion(Version) contain a
false optimization that only updates the member if the value were to
change.

Since assignment in Java is much cheaper than equality checking, simply
updating the value of the member, regardless of whether it changed or
not, would be much faster than this so-called optimization.

Change-Id: I0166fccf2188360b2e8812b462eb5c79d25aebe4
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
2 files changed, 2 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/21397/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index 1efc986..7f7be68 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -206,9 +206,7 @@
     }
 
     public void setVdsGroupCompatibilityVersion(Version value) {
-        if (Version.OpInequality(vdsGroupCompatibilityVersion, value)) {
-            this.vdsGroupCompatibilityVersion = value;
-        }
+        this.vdsGroupCompatibilityVersion = value;
     }
 
     public Guid getVdsGroupId() {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index 2317fc1..e598608 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -840,9 +840,7 @@
     }
 
     public void setVdsGroupCompatibilityVersion(Version value) {
-        if (Version.OpInequality(getVdsGroupCompatibilityVersion(), value)) {
-            this.vdsGroupCompatibilityVersion = value;
-        }
+        this.vdsGroupCompatibilityVersion = value;
     }
 
     private String vdsGroupName;


-- 
To view, visit http://gerrit.ovirt.org/21397
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0166fccf2188360b2e8812b462eb5c79d25aebe4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to