[IronPython] Jit leak in defaultdict for Ipy 2.6.2

Idan Zaltzberg idan at cloudshare.com
Mon Nov 29 04:09:35 PST 2010


Hi,

I have noticed the following method always adds a jitted method (looking at
the ".NET CLR Jit" performance counter) when it is run:

def f():

                d = defaultdict(int)

                d[0]



I created my own implementation of defaultdict (in ipy):

class defaultdict(dict):

    def __init__(self, cls):

        super(defaultdict, self).__init__()

        self.cls = cls

    def __getitem__(self, key):

        if key not in self:

            self[key] = self.cls()

        return super(defaultdict, self).__getitem__(key)



And I noticed that it does not leak JIT and it works 200 times faster when
running the method f().

Can you please look why this happens in the current implementation?

Also I was wondering if there are any other utility methods that use similar
code and probably will have the same problem.



Thanks,

Idan zalzberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20101129/8c2034a7/attachment.htm>


More information about the Users mailing list