Thanks again for the performance improvement. As the copyright paperwork is done I installed it onto Savannah, along with attached minor followup patches.
From 12b58a69aa97acf12403065fb7b4a2b6e22cd7e9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 21 Aug 2023 13:40:37 -0700
Subject: [PATCH 1/2] Simplify recently-added hash code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/extract.c (delay_set_stat): Simplify hash lookup;
no need to initialize members other than file_name.
Avoid assignment in ‘if’ when it’s easy.
(extract_finish): Do not bother to free when we are about to exit.
---
 src/extract.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/extract.c b/src/extract.c
index a0263bb5..0261134f 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -535,9 +535,11 @@ delay_set_stat (char const *file_name, struct tar_stat_info const *st,
 	                                               ds_compare, NULL))))
     xalloc_die ();
 
-  const struct delayed_set_stat key = { .file_name = (char*) file_name };
+  struct delayed_set_stat key;
+  key.file_name = (char *) file_name;
 
-  if ((data = hash_lookup (delayed_set_stat_table, &key)) != NULL)
+  data = hash_lookup (delayed_set_stat_table, &key);
+  if (data)
     {
       if (data->interdir)
 	{
@@ -1847,7 +1849,7 @@ extract_archive (void)
   if (!delay_directory_restore_option)
     {
       int dir = chdir_current;
-      apply_nonancestor_delayed_set_stat (current_stat_info.file_name, 0);
+      apply_nonancestor_delayed_set_stat (current_stat_info.file_name, false);
       chdir_do (dir);
     }
 
@@ -1961,7 +1963,7 @@ apply_delayed_links (void)
   for (struct delayed_link *ds = delayed_link_head; ds; ds = ds->next)
     apply_delayed_link (ds);
 
-  if (false)
+  if (false && delayed_link_table)
     {
       /* There is little point to freeing, as we are about to exit,
 	 and freeing is more likely to cause than cure trouble.
@@ -1977,7 +1979,7 @@ void
 extract_finish (void)
 {
   /* First, fix the status of ordinary directories that need fixing.  */
-  apply_nonancestor_delayed_set_stat ("", 0);
+  apply_nonancestor_delayed_set_stat ("", false);
 
   /* Then, apply delayed links, so that they don't affect delayed
      directory status-setting for ordinary directories.  */
@@ -1985,11 +1987,13 @@ extract_finish (void)
 
   /* Finally, fix the status of directories that are ancestors
      of delayed links.  */
-  apply_nonancestor_delayed_set_stat ("", 1);
+  apply_nonancestor_delayed_set_stat ("", true);
 
-  /* This table should be empty after apply_nonancestor_delayed_set_stat  */
-  if (delayed_set_stat_table != NULL)
+  /* This table should be empty after apply_nonancestor_delayed_set_stat.  */
+  if (false && delayed_set_stat_table)
     {
+      /* There is little point to freeing, as we are about to exit,
+	 and freeing is more likely to cause than cure trouble.  */
       hash_free (delayed_set_stat_table);
       delayed_set_stat_table = NULL;
     }
-- 
2.41.0

From a9a8990fb3b8ff4765151bccea9667e4b6a4fc0c Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 21 Aug 2023 13:41:42 -0700
Subject: [PATCH 2/2] Bump extrac26 timeout

* tests/extrac26.at: Increase timeout from 15 to 60 s.
On my old machine it took 15 s.
---
 tests/extrac26.at | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/extrac26.at b/tests/extrac26.at
index 48fe468b..35005b1a 100644
--- a/tests/extrac26.at
+++ b/tests/extrac26.at
@@ -31,7 +31,7 @@ tar -cf archive.tar dirtree
 
 echo Extracting archive
 mkdir output
-timeout 15 tar -xf archive.tar --delay-directory-restore -C output
+timeout 60 tar -xf archive.tar --delay-directory-restore -C output
 ],
 [0],
 [Creating dirtree
-- 
2.41.0

Reply via email to