Rob Crittenden wrote:
Attached is a rough cut of a patch to try to speed up the cli a little
bit. Basically in production mode it will skip some things during
initialization.

My concept is that we develop in mode != production and release in mode
== production.

I managed to knock a second or so off time to do a user-show on average.

There may be some other things we can do to speed things up, I'm still
looking. Some feedback on the approach would be appreciated.

Note that I've completely ruled out SSL/Negotiate. I did my testing on
lite-server which doesn't use SSL or Negotiate and it was STILL taking
on average 3-4+ seconds per command. The server side was consistently
taking < 1 second to complete.

rob

oh, and the patch.
>From 75dcb2e51defdfed9d5adc44c70e9fdb23995ef3 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Tue, 18 Jan 2011 17:23:54 -0500
Subject: [PATCH] Attempt #1 at speeding up cli

---
 ipalib/frontend.py |    7 ++++---
 ipalib/plugable.py |    8 ++++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index eeed398..51fa524 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -351,9 +351,10 @@ class HasParam(Plugin):
             self._filter_param_by_context(name, env),
             sort=False
         )
-        check = getattr(self, 'check_' + name, None)
-        if callable(check):
-            check(namespace)
+        if self.env.mode != 'production':
+            check = getattr(self, 'check_' + name, None)
+            if callable(check):
+                check(namespace)
         setattr(self, name, namespace)
 
 
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 264bb68..93fc177 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -207,6 +207,8 @@ class Plugin(ReadOnly):
     def finalize(self):
         """
         """
+        if self.env.mode == 'production':
+            return
         lock(self)
 
     def set_api(self, api):
@@ -609,11 +611,13 @@ class API(DictProxy):
 
         for p in plugins.itervalues():
             p.instance.set_api(self)
-            assert p.instance.api is self
+            if self.env.mode != 'production':
+                assert p.instance.api is self
 
         for p in plugins.itervalues():
             p.instance.finalize()
-            assert islocked(p.instance) is True
+            if self.env.mode != 'production':
+                assert islocked(p.instance) is True
         object.__setattr__(self, '_API__finalized', True)
         tuple(PluginInfo(p) for p in plugins.itervalues())
         object.__setattr__(self, 'plugins',
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to