Author rhettinger
Recipients alexandre.vassalotti, josh.r, rhettinger, serhiy.storchaka
Date 2016-03-06.09:36:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457256994.96.0.689865799504.issue26167@psf.upfronthosting.co.za>
In-reply-to
Content
One suggestion:

    def _deepcopy_list(x, memo, deepcopy=deepcopy):
        y = []
        memo[id(x)] = y
        y[:] = [deepcopy(a, memo) for a in x]
        return y

This looks nicer and should run faster by taking advantage of the LIST_APPEND opcode.

It should be noted that the core concept of the patch is all about the minimizing the calling overhead of the copying operation (the cost to call type(x) and the overhead in the type constructors for parsing the positional and keyword arguments).  When it comes to actually copying the data in the containers, there underlying code to do the copying is the same for both the patched and unpatched version (that is why you see a speed-up for copying empty containers and almost no change for containers that have data in them).
History
Date User Action Args
2016-03-06 09:36:35rhettingersetrecipients: + rhettinger, alexandre.vassalotti, serhiy.storchaka, josh.r
2016-03-06 09:36:34rhettingersetmessageid: <1457256994.96.0.689865799504.issue26167@psf.upfronthosting.co.za>
2016-03-06 09:36:34rhettingerlinkissue26167 messages
2016-03-06 09:36:34rhettingercreate