Alexander Wels has uploaded a new change for review.

Change subject: webadmin: reduce autocompleter time in chrome
......................................................................

webadmin: reduce autocompleter time in chrome

- The profiler in chrome was indicating that the autocompleter
  was taking significant amounts of time during login. This time
  was taken mostly loading the exception handlers. I modified
  the code to not throw exceptions during the time of day lookup.
  Running the profiler in FF didn't seem to be affected by this.

Change-Id: I3f9f0e26274caef5745d2adae9d573498ca6cf4c
Signed-off-by: Alexander Wels <[email protected]>
---
M 
backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/BaseAutoCompleter.java
1 file changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/33683/1

diff --git 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/BaseAutoCompleter.java
 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/BaseAutoCompleter.java
index 0439fc6..6b63fae 100644
--- 
a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/BaseAutoCompleter.java
+++ 
b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/BaseAutoCompleter.java
@@ -15,6 +15,14 @@
     protected final Map<String, List<String>> mVerbCompletion =
             new HashMap<String, List<String>>();
 
+    private static final List<String> daysOfWeek = new ArrayList<String>();
+
+    static {
+        for(DayOfWeek day: DayOfWeek.values()) {
+            daysOfWeek.add(day.toString());
+        }
+    }
+
     public BaseAutoCompleter() {
 
     }
@@ -77,12 +85,8 @@
 
     @Override
     public String changeCaseDisplay(String text) {
-        try {
-            if (DayOfWeek.valueOf(text) != null) {
-                return text;
-            }
-        } catch (Exception e) {
-            // no enum value found for this literal
+        if (daysOfWeek.contains(text)) {
+            return text;
         }
         return text.toLowerCase();
     }


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

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

Reply via email to