Liran Zelkha has posted comments on this change.

Change subject: core: Cache GUID creation
......................................................................


Patch Set 1: (1 inline comment)

....................................................
File 
backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/NGuid.java
Line 20:             5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15 };
Line 21:     private static final byte[] KEEP_BYTE_ORDER_INDICES = { 0, 1, 2, 3,
Line 22:             4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
Line 23: 
Line 24:     private Map<String, UUID> cachedGuids = new HashMap<String, 
UUID>();
True. Needs to be static. 
Current profiler results show about 7-10% of execution time is spent on this 
UUID.fromString(), so caching the results of these method calls is highly 
effective.
Thread safety is not really an issue. The worst that can happen is that a 
String is parsed twice to a UUID, which is better (performance wise) than 
synch'ing the access to the map.
Concerning the size of the map - the number of UUID in the system is finite, 
and not necessarily large. We can build a limit mechanism, I'll try to build a 
mechanism to show the usage scenario of each UUID and see if we can benefit 
from limiting the number of UUIDs.
Line 25:     
Line 26:     public final static Guid Empty = new Guid();
Line 27: 
Line 28:     public static Guid NewGuid() {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I49a103f6194d9c4b703c1bc965b5a56bba4e9634
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to