View Single Post
Old 08-07-2014, 01:13 AM   #490
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by BetterRed View Post
Good to know the sorting is done at the end, otherwise my faith in kiwidudes good sense would have been called into question.

Curious: Why would you you expect sorting a collection of ints to be slower than sorting a collection of char arrays
It isn't sorting just by an integer. The sort code is:

Code:
if by_title:
    skeys = sorted(candidates_map.keys())
else:
    skeys = sorted(candidates_map.keys(),
               key=lambda ckey: '%04d%s' % (len(candidates_map[ckey]), ckey),
               reverse=True)
So, get the count of duplicates books for a title, convert to string and combine with the title. That will be slower for a lot of duplicates, but I'm not sure how noticeable it would be.
davidfor is offline   Reply With Quote