Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2021, 09:42 AM   #691
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
@chaley: First, thanks for your time and effort.

I tested your changes, and so far they are working well. I ran your test as well as some other tests related to Last Modified Plugin and all is working as expected. Signals are are only released for fields for whose the value is altered.

How do you think this will impact calibre's performance?
capink is offline   Reply With Quote
Old 09-13-2021, 10:01 AM   #692
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,393
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
How do you think this will impact calibre's performance?
It could go either way. Setting a field to its current value will be significantly faster because it isn't dirtied (queued for metadata backup), the last_modified isn't set, and in several cases a database update is avoided.

If a field is really being changed: many-to-many fields like tags won't see a hit because they already did the optimisation. Other fields now have a bit more processing to check if the value is being changed. In some cases a field was being updated twice (e.g., custom series indices), which is no longer happening.



I will make a pull request and see what Kovid thinks.
chaley is offline   Reply With Quote
Old 09-13-2021, 05:31 PM   #693
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,684
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
It could go either way. Setting a field to its current value will be significantly faster because it isn't dirtied (queued for metadata backup), the last_modified isn't set, and in several cases a database update is avoided.
As you may recall, I do 99% of metadata edits in in the Book List. After tapping F2 on the first cell I want to change, I use Tab to move across the cells whilst remaining in edit mode; and I often Tab through cells, leaving them as-is or empty as the case may be.

Will this change have any effect on that mode of use, if anything it appears it might improve performance.

I don't use the AC or LM plugins.

BR
BetterRed is offline   Reply With Quote
Old 09-13-2021, 05:55 PM   #694
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,393
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
As you may recall, I do 99% of metadata edits in in the Book List. After tapping F2 on the first cell I want to change, I use Tab to move across the cells whilst remaining in edit mode; and I often Tab through cells, leaving them as-is or empty as the case may be.

Will this change have any effect on that mode of use, if anything it appears it might improve performance.
These changes won't affect this "mode of use" in any significant way. It takes much longer to process hitting Tab and update the GUI than to check if the field changed. In addition I think that the editors already check if something changed, in which case you will see no change at all.
chaley is offline   Reply With Quote
Old 09-13-2021, 05:59 PM   #695
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
In addition I think that the editors already check if something changed, in which case you will see no change at all.
I think not. You can verify that by pressing F2 followed by enter without changing the value, and then checking the last_modified value. That changes made by chaley will ensure this will not happen.
capink is offline   Reply With Quote
Old 09-13-2021, 06:03 PM   #696
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,684
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@chaley - tks

can I draw you attention to the last post in this thread ==>> https://www.mobileread.com/forums/sh...d.php?t=341670

cheers BR
BetterRed is offline   Reply With Quote
Old 09-13-2021, 06:11 PM   #697
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,393
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
I think not. You can verify that by pressing F2 followed by enter without changing the value, and then checking the last_modified value. That changes made by chaley will ensure this will not happen.
It depends on the field. I tried it with Authors, Title, an enumerated column, and an integer column. Edit/return on the Authors and the enum column didn't change last_modified. The other two did.

These results doesn't negate what you said, that the editors don't do the check. I think the difference is that many-many columns already have the check in the db layer.
chaley is offline   Reply With Quote
Old 09-13-2021, 06:32 PM   #698
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,684
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by capink View Post
I think not. You can verify that by pressing F2 followed by enter without changing the value, and then checking the last_modified value. That changes made by chaley will ensure this will not happen.
That's what I thought.

If I do as you suggest the Last Modified date changes to Now and the disk rattles as a fresh metadata.opf is written to the book folder on every cell I tab through whilst in Edit mode.

The slight performance hit doesn't bother me. I find editing in the list much easier, hence faster than editing in dialogue boxes.

Added: I think we're all agreed these changes shouldn't have any deleterious effect on editing metadata on the book List, if anything the opposite. If KG accepts @chaley's changes I'll make of point of letting y'all know.

BR

Last edited by BetterRed; 09-13-2021 at 06:43 PM.
BetterRed is offline   Reply With Quote
Old 09-14-2021, 05:46 AM   #699
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,393
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
Added: I think we're all agreed these changes shouldn't have any deleterious effect on editing metadata on the book List, if anything the opposite. If KG accepts @chaley's changes I'll make of point of letting y'all know.

BR
The changes are now in master source.
chaley is offline   Reply With Quote
Old 09-14-2021, 06:13 AM   #700
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
@chaley: Thanks again. You help has been, as always, invaluable.
capink is offline   Reply With Quote
Old 09-14-2021, 08:02 AM   #701
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Question: I have several cleanup chains that modify multiple columns in a row. Unfortunately Last Modified seems to trigger for all of them which causes a slight pause between each action; running the chain with my column turned off sped things up considerably.

Is there a way to alleviate this, such as making it trigger only on the last change?
I think I have a solution for this now. I will add a hibernation mode for the Last Modified plugin, which can be activated by other plugins. During this hibernation period, the plugin will listen to and cache db events without taking any action. After getting out of the hibernation mode, it will re-emit one db event per field (for all books) to enhance performance.

This will need modifications to both Last Modified and Action Chains, and will only be released after the release of the next version of calibre.

Last edited by capink; 09-14-2021 at 08:28 AM.
capink is offline   Reply With Quote
Old 09-14-2021, 08:29 AM   #702
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by capink View Post
I think I have a solution for this now. I will add a hibernation mode for the Last Modified plugin, which can be activated by other plugins. During this hibernation period, the plugin will listen to and cache db events without taking any action. After getting out of the hibernation mode, it will re-emit one db event per field (for all books) to enhance performance.

This will need modifications to both Last Modified and Action Chains, and will only be released after the release of the next version of calibre.

@chaley: How can I incorporate the advice below with set_field()

Quote:
Originally Posted by chaley View Post
But with auto-commit turned off so the transactions are grouped into one commit.
capink is offline   Reply With Quote
Old 09-14-2021, 08:35 AM   #703
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,393
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
@chaley: How can I incorporate the advice below with set_field()
I don't think you can. cache.set_metadata() does it by wrapping the set_field()s in a "with db" connection. You don't have that option.

The best approach would be to gather together all the changes to a field and apply them with one set_field. Something like a caching single_field_edit action that is paired with a commit action. This might introduce timing problems though.
chaley is offline   Reply With Quote
Old 09-14-2021, 08:48 AM   #704
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,194
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
The commit question was about optimizing performance when calling set_field() for multiple fields (date fields by Last Modified), but it is not a big deal. Thanks.
capink is offline   Reply With Quote
Old 09-15-2021, 06:10 PM   #705
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,863
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Btw, since I can run from source I am willing to do some testing.
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
Action Chains Resources capink Plugins 77 06-16-2025 12:45 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


All times are GMT -4. The time now is 01:52 AM.


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