Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2017, 02:19 AM   #1
moredrowsy
Connoisseur
moredrowsy began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Aug 2016
Device: Kindle Paperwhite 3
Custom icon performance

I'm having lag issues with custom icon rules.

I've added a dozen rules for custom icons. 5 icons for 1-5 star ratings. Then 7 icons for different shelf values. My library is around 18k books.

After adding the icon rules, there's a huge performance hit. Scrolling through the list of books is very very slow and thus laggy. I've tried using from 512x512 icons to 32x32 icons and it is still laggy. Regardless of icon pixels though, all the icons set total to 382kb, which isn't a lot.

I've tried deleting the rules and the lag is gone. I've tried the icon rules on a smaller library of ~1000 books and the lag is still there, albeit not as laggy but still lags.

So, just wondering if anyone has same problem and if there any tips to improve performance? Note: I don't think my computer (amd octocore and 16gb of ram with ssd) is that slow for adding 12 icons to the rules set, or is it?

Attached a pic of icon rules and it seems pretty simple and not a lot, which I don't understand why it will lag so much.
Attached Thumbnails
Click image for larger version

Name:	custom-icon-rules.jpg
Views:	172
Size:	62.2 KB
ID:	157830  

Last edited by moredrowsy; 07-09-2017 at 02:27 AM.
moredrowsy is offline   Reply With Quote
Old 07-09-2017, 03:42 AM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by moredrowsy View Post
I'm having lag issues with custom icon rules.

I've added a dozen rules for custom icons. 5 icons for 1-5 star ratings. Then 7 icons for different shelf values. My library is around 18k books.

After adding the icon rules, there's a huge performance hit. Scrolling through the list of books is very very slow and thus laggy. I've tried using from 512x512 icons to 32x32 icons and it is still laggy. Regardless of icon pixels though, all the icons set total to 382kb, which isn't a lot.

I've tried deleting the rules and the lag is gone. I've tried the icon rules on a smaller library of ~1000 books and the lag is still there, albeit not as laggy but still lags.

So, just wondering if anyone has same problem and if there any tips to improve performance? Note: I don't think my computer (amd octocore and 16gb of ram with ssd) is that slow for adding 12 icons to the rules set, or is it?

Attached a pic of icon rules and it seems pretty simple and not a lot, which I don't understand why it will lag so much.
Are any of the rules based on columns built from other columns, they are the more likely to slow things down rather than icon size. IIRC chaley told me that 128x128 square pngs are optimal.

If you can use general program mode templates for the icon rules that should make it faster because GPM templates apparently end up as compiled Python, see ==>> Using general program mode

If you can post a couple of the icon rules one of the templating wizards should be able to make some suggestions.

Added : It would be nice if one could disable icon/color rules one by one, or en marche masse

BR

Last edited by BetterRed; 07-09-2017 at 03:48 AM.
BetterRed is offline   Reply With Quote
Advert
Old 07-09-2017, 05:15 AM   #3
moredrowsy
Connoisseur
moredrowsy began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Aug 2016
Device: Kindle Paperwhite 3
The columns are not composite; one column is the normal "rating" and the other is a custom "#shelf" with direct values. I don't know how to use advanced rule since I don't know how to do programming language. Just a regular smoe joe.

I've changed all the icons to 128x128 pngs but it didn't make a difference.

Thanks for the help.

Attached is the rules wizard for the icon rules for the ones that are shown.
Attached Thumbnails
Click image for larger version

Name:	rules-wizard.jpg
Views:	158
Size:	100.6 KB
ID:	157832   Click image for larger version

Name:	rules-wizard2.jpg
Views:	146
Size:	100.8 KB
ID:	157833  

Last edited by moredrowsy; 07-09-2017 at 05:28 AM.
moredrowsy is offline   Reply With Quote
Old 07-09-2017, 07:42 AM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by moredrowsy View Post
The columns are not composite; one column is the normal "rating" and the other is a custom "#shelf" with direct values. I don't know how to use advanced rule since I don't know how to do programming language. Just a regular smoe joe.

I've changed all the icons to 128x128 pngs but it didn't make a difference.

Thanks for the help.

Attached is the rules wizard for the icon rules for the ones that are shown.
What sort of column is Shelf

I am pretty sure your rules could be optimised, but I'm no great shakes at template code. chaley is your best bet, he will hopefully see the thread and make some suggestions - if he doesn't send him a PM and ask him to take a look at the thread. Added - see this

FWIW I have a library of 10K+ books with 10 icon rules, it's not noticably faster or slower than another library of 110K+ books with no icons, or another with 5K books and 21 icons. Could be the way I use my libraries - I don't do a lot of scrolling up and down looking for things.

BR

Last edited by BetterRed; 07-09-2017 at 07:50 AM.
BetterRed is offline   Reply With Quote
Old 07-09-2017, 09:07 AM   #5
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I don't know why the performance is so bad for you. Are you running 64-bit calibre? If not, then try that.

You can improve the performance of the two basic tests by using an advanced rule. Here is an example for Rating, replacing all 5 current rules.
Click image for larger version

Name:	Clipboard01.jpg
Views:	142
Size:	68.3 KB
ID:	157838
The text in that box is:
Code:
program:
	first_matching_cmp(
		field('rating'),
		0.1, '',
		1.1, 'emoticon.png',
		2.1, 'sceptic.png',
		3.1, 'winking.png',
		4.1, 'happy.png',
		'in-love.png')
It works by comparing (rating < value) where value is 0.1, 1.1, etc, returning the string (file name) if the comparison succeeds. As such, the first comparison succeeds if rating is 0 (less than 0.1), and so on.

You would do something similar for the second one (Shelves) but using the "switch" function to set up the comparisons. Assuming that "Shelf" contains a single value (not like tags) then something like this would work.
Code:
program:
    switch(
        "read", "success.png",
        "to-read", "play-button.png"
and so on. If Shelf is like-tags then you will need to do something different, probably using first_non_empty and in_list
chaley is offline   Reply With Quote
Advert
Old 07-09-2017, 12:17 PM   #6
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Assuming that #shelf is a text-type (perhaps with a fixed set of values) then this advanced rule should work.
Click image for larger version

Name:	Clipboard01.jpg
Views:	162
Size:	59.7 KB
ID:	157846

Here is the text shown in the dialog
Code:
program:
	switch(
		field('#enum2'),
		'^read$', 'success.png',
		'^to-read$', 'play-button.png',
		'^backlog$', 'line.png',
		'^dnf$', 'error.png',
		'^dont-touch$', 'forbidden-light-grey.png',
		'^currently-reading$', 'medical-1.png',
		'^favorite$', 'eye-1.png',
		'')
The search fields (read, to-read, etc) are regular expressions, which is why they are anchored (begin with ^ and end with $).

I used #enum2 because I don't have a column named #shelf.
chaley is offline   Reply With Quote
Old 07-09-2017, 02:43 PM   #7
moredrowsy
Connoisseur
moredrowsy began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Aug 2016
Device: Kindle Paperwhite 3
Thanks BetterRed and Chaley!

Chaley's script helped. The lag is gone. Wow. Thanks a lot!

Edit: I never noticed a slight lag with the coloring scheme too. So I edited your script for the coloring as advance rules. The lag is completely gone with the advance rules for column coloring and column icons. This is awesome. Again, thanks a bunch!

Last edited by moredrowsy; 07-09-2017 at 03:02 PM.
moredrowsy is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Custom Icon with two requirements One4Tanner Library Management 3 03-11-2015 02:14 AM
Custom Collection Icon? ACardAttack Kindle Developer's Corner 1 03-05-2015 08:05 AM
Custom Column Icon Help alanHd Library Management 2 02-04-2013 03:30 AM
Problem with Tag Browser Custom Icon for Languages MartyTX Library Management 1 02-03-2013 03:44 AM
Custom Icon Issues allovertheglobe iRex 0 10-26-2008 03:40 PM


All times are GMT -4. The time now is 05:45 PM.


MobileRead.com is a privately owned, operated and funded community.