[omniORB] omniorbpy: switching GC off for duration of every outgoing call
Michael Kilburn
crusader.mike at gmail.com
Sat Apr 18 04:07:27 BST 2015
Hi,
On Mon, 2015-01-12 at 23:48 -0600, Michael Kilburn wrote:
> Is there any easy way in omniOrbPy to automatically switch gc off in
> every outgoing call? (and then switch it back once all data is
> received and converted to python objects)
On Tue, Jan 20, 2015 at 6:05 PM, Michael Kilburn <crusader.mike at gmail.com>
wrote:
> Here is the solution I came up with:
>
> import _omnipy
> _omnipy_invoke = _omnipy.invoke
>
> def invoke_mk2(*args):
> import gc
> gc_flag = gc.isenabled()
> try:
> if gc_flag: gc.disable()
> return _omnipy_invoke(*args)
> finally:
> if gc_flag: gc.enable()
>
> _omnipy.invoke = invoke_mk2
>
>
As you see I solved the problem by intercepting and wrapping
_omnipy.invoke(). Unfortunately in Omni4.x we have:
class _objref_MyInterface(CORBA.Object):
_NP_RepositoryId = MyInterface._NP_RepositoryId
def __init__(self, obj):
CORBA.Object.__init__(self, obj)
def myMethod(self, *args):
return self._obj.invoke("myMethod", ..., args)
i.e. there is no single method to intercept for an easy fix. Or better to
say, I did not find it yet.
Can anyone advise a good way to achieve this?
> Apparently problem this snippet solves was addressed in Python 2.7.
> Though, I would imagine switching off GC completely is still better than
> reducing number of collections.
>
Switching off GC gives a nice performance boost even with Python 2.7 (in my
tests)
--
Sincerely yours,
Michael.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20150417/50239332/attachment.html>
More information about the omniORB-list
mailing list