View Single Post
Old 04-19-2011, 05:10 AM   #9
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,463
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by silentguy View Post
With a large library (~10.000 books) it takes around 6 seconds to start calibre (with or without my column) but if i tell it to display my column, it takes around 36 seconds to load. Is it really this expensive to build the tag tree? It is there a resource leak somewhere?
Yes, it really is that expensive. These columns are not really tags (and cannot be). Computing the list of tags requires:
For every book in the database:
- split the field apart into its component tags (split on comma)
- check if an individual component has been seen before. If not, add it to the tags values data structures.

For real tags fields, this happens once instead of once per book, because the individual tag values are available in the database. In your case, this means that there are 10,000 more loops.

That said, while looking at the code I did notice a few things that I could improve, so performance might get somewhat better.
chaley is offline   Reply With Quote