Author ssapin
Recipients rhettinger, ssapin
Date 2012-01-09.10:43:35
SpamBayes Score 0.00172323
Marked as misclassified No
Message-id <1326105816.66.0.903535644472.issue13742@psf.upfronthosting.co.za>
In-reply-to
Content
The attached script benchmarks the basline (current implementation) against 3 new implementations, as suggested on http://mail.python.org/pipermail/python-ideas/2012-January/013296.html

On my machine, the output is:

    merge_baseline
    per run, min of 3 = 7.527 ms
    
    merge_1
    per run, min of 3 = 9.894 ms
    131.449 % of baseline
    
    merge_2
    per run, min of 3 = 7.948 ms
    105.594 % of baseline
    
    merge_3
    per run, min of 3 = 7.581 ms
    100.716 % of baseline

On this particular input, merge_2 adds 6% of overhead when the key parameter is not used. While merge_3 only adds 1% of overhead, it almost doubles the amount of code. (Which was admittedly not that long to begin with.)

The patch in the previous message is with the merge_2 implementation, which seemed like the best compromise to me.
History
Date User Action Args
2012-01-09 10:43:37ssapinsetrecipients: + ssapin, rhettinger
2012-01-09 10:43:36ssapinsetmessageid: <1326105816.66.0.903535644472.issue13742@psf.upfronthosting.co.za>
2012-01-09 10:43:36ssapinlinkissue13742 messages
2012-01-09 10:43:35ssapincreate