Change in ovirt-engine[master]: webadmin: isOptionEnabledOnVolume Linq

amureini at redhat.com amureini at redhat.com
Thu Dec 3 10:31:20 UTC 2015


Allon Mureinik has submitted this change and it was merged.

Change subject: webadmin: isOptionEnabledOnVolume Linq
......................................................................


webadmin: isOptionEnabledOnVolume Linq

Replaced the usage of ListUtils in this method to the frontend's
standard Linq. This patch achieves three things:

1. It standardizes the code and aligns this method to the same utility
   (Linq) the rest of the frontend uses.

2. It makes the code shorter and more intuitive to understand.

3. It improves performance. The original implementation copied the
   list (an O(n) operation) and then ran over it and filtered it
   (another O(n) operation), only to check if the resulting filtered
   list was empty or not.
   The new implementation runs over the list only once, and terminates
   immediately when finding a match. In the worst case this is an O(n)
   operation (if no matches are found), meaning this patch should, at
   the very least, should half the number of operations performed.
   Memory-wise, instead of holding two additional copies of the list,
   the new implementation performs its logic in-place.

Change-Id: Ifa75601502e7de49f94645c593170b18b97a4de8
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
1 file changed, 6 insertions(+), 10 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Allon Mureinik: Verified; Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/49618
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa75601502e7de49f94645c593170b18b97a4de8
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Sahina Bose <sabose at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list