<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 9 March 2017 at 21:04, Barry Scott <span dir="ltr"><<a href="mailto:barry@barrys-emacs.org" target="_blank">barry@barrys-emacs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>It was not clear to me that you need to scan the list at the start to make sure its homogeneous. Given that the type check is so cheap will it</div><div>slow the sort if you do the pointer check in the compare code? I am not suggesting you run rich compare full fat on each compare.</div></div></div></blockquote><div><br></div><div>Isn't there already always a scan of the iterable to build the keys array for sorting (even if no key keyword param is specified)? In which case adding the homogenity check there seems like it shouldn't add much overhead at all (I have to say that I was surprised with 10+% reductions in speed in some of the heterogenous TimSort tests for this reason).</div><div><br></div><div>And could specific richcompares be refactored so there was a "we really know what the types are is, no need to check" version available to sort() (with the typechecking version available for general use/unoptimised sorting)?</div><div><br></div><div>Tim Delaney </div></div></div></div>