* Request for testing: incremental improvement in move / rename handling
@ 2020-07-31 10:33 David Bremner
2020-07-31 10:33 ` [PATCH 1/2] WIP: provide alternate API for n_d_remove_message David Bremner
2020-07-31 10:33 ` [PATCH 2/2] WIP: use new API in notmuch-new David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2020-07-31 10:33 UTC (permalink / raw)
To: notmuch
In my tests with the performance suite I'm seeing 5-10% improvements
in the relevant parts of performance-test/T00-new.sh. That's not
nothing, but it does require an API change, so if a few people could
test these patches on real world large scale "notmuch new after mv/rm"
I would appreciate it. I'm particularly curious about results from
spinning rust disks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] WIP: provide alternate API for n_d_remove_message
2020-07-31 10:33 Request for testing: incremental improvement in move / rename handling David Bremner
@ 2020-07-31 10:33 ` David Bremner
2020-07-31 10:33 ` [PATCH 2/2] WIP: use new API in notmuch-new David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2020-07-31 10:33 UTC (permalink / raw)
To: notmuch; +Cc: David Bremner
the idea is to reduce code duplication and extra object creation with notmuch new
---
lib/database.cc | 18 ++++++++++++++----
lib/notmuch.h | 5 +++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/database.cc b/lib/database.cc
index 75189685..72592a88 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -2035,8 +2035,16 @@ notmuch_status_t
notmuch_database_remove_message (notmuch_database_t *notmuch,
const char *filename)
{
+ return notmuch_database_remove_filename (notmuch, filename, NULL);
+}
+
+notmuch_status_t
+notmuch_database_remove_filename (notmuch_database_t *notmuch,
+ const char *filename,
+ notmuch_message_t **message_ptr) {
+
+ notmuch_message_t *message = NULL;
notmuch_status_t status;
- notmuch_message_t *message;
status = notmuch_database_find_message_by_filename (notmuch, filename,
&message);
@@ -2048,12 +2056,14 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
_notmuch_message_sync (message);
- notmuch_message_destroy (message);
+ if (message_ptr) {
+ *message_ptr = message;
+ } else {
+ notmuch_message_destroy (message);
+ }
}
-
return status;
}
-
notmuch_status_t
notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
const char *filename,
diff --git a/lib/notmuch.h b/lib/notmuch.h
index f9e9cc41..e4c3d2ee 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -734,6 +734,11 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
const char *filename,
notmuch_message_t **message);
+notmuch_status_t
+notmuch_database_remove_filename (notmuch_database_t *notmuch,
+ const char *filename,
+ notmuch_message_t **message);
+
/**
* Return a list of all tags found in the database.
*
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] WIP: use new API in notmuch-new
2020-07-31 10:33 Request for testing: incremental improvement in move / rename handling David Bremner
2020-07-31 10:33 ` [PATCH 1/2] WIP: provide alternate API for n_d_remove_message David Bremner
@ 2020-07-31 10:33 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2020-07-31 10:33 UTC (permalink / raw)
To: notmuch; +Cc: David Bremner
---
notmuch-new.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/notmuch-new.c b/notmuch-new.c
index 4075d395..95ca9971 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -939,11 +939,8 @@ remove_filename (notmuch_database_t *notmuch,
status = notmuch_database_begin_atomic (notmuch);
if (status)
return status;
- status = notmuch_database_find_message_by_filename (notmuch, path, &message);
- if (status || message == NULL)
- goto DONE;
- status = notmuch_database_remove_message (notmuch, path);
+ status = notmuch_database_remove_filename (notmuch, path, &message);
if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
add_files_state->renamed_messages++;
if (add_files_state->synchronize_flags == true)
@@ -954,7 +951,6 @@ remove_filename (notmuch_database_t *notmuch,
}
notmuch_message_destroy (message);
- DONE:
notmuch_database_end_atomic (notmuch);
return status;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-31 10:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 10:33 Request for testing: incremental improvement in move / rename handling David Bremner
2020-07-31 10:33 ` [PATCH 1/2] WIP: provide alternate API for n_d_remove_message David Bremner
2020-07-31 10:33 ` [PATCH 2/2] WIP: use new API in notmuch-new David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).