[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: More efficient subnode dumping
From: |
Gavin D. Smith |
Subject: |
branch master updated: More efficient subnode dumping |
Date: |
Tue, 18 Oct 2022 07:42:25 -0400 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new f7e8f926d7 More efficient subnode dumping
f7e8f926d7 is described below
commit f7e8f926d74c9dda4c4bf350a407f4d9448c4d98
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Oct 18 12:42:16 2022 +0100
More efficient subnode dumping
* info/session.c (dump_node_to_stream): Take a FILE_BUFFER *
argument rather than a filename. Only get nodes from this file
buffer, using info_get_node_of_file_buffer. This avoids looking
for the file for every node when dumping subnodes.
(dump_nodes_to_file): Call info_find_file before calling
dump_node_to_stream.
Hilmar Preusse reported that "info python3.8 >/dev/null" had
extremely high memory usage. python3.8.info.gz was over 4MB
in size, and had more than 4500 nodes.
---
ChangeLog | 19 +++++++++++++++++++
info/filesys.c | 2 +-
info/session.c | 51 +++++++++++++++++++++++++++------------------------
3 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 15b50b4fee..298dcfa583 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2022-10-18 Gavin Smith <gavinsmith0123@gmail.com>
+
+ More efficient subnode dumping
+
+ * info/session.c (dump_node_to_stream): Take a FILE_BUFFER *
+ argument rather than a filename. Only get nodes from this file
+ buffer, using info_get_node_of_file_buffer. This avoids looking
+ for the file for every node when dumping subnodes.
+ (dump_nodes_to_file): Call info_find_file before calling
+ dump_node_to_stream.
+
+ Hilmar Preusse reported that "info python3.8 >/dev/null" had
+ extremely high memory usage. python3.8.info.gz was over 4MB
+ in size, and had more than 4500 nodes.
+
+2022-10-18 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * info/filesys.c (info_find_fullpath): Change a comment.
+
2022-10-18 Gavin Smith <gavinsmith0123@gmail.com>
* info/man.c (check_manpage_node):
diff --git a/info/filesys.c b/info/filesys.c
index 47060e002e..99497bbfb0 100644
--- a/info/filesys.c
+++ b/info/filesys.c
@@ -105,7 +105,7 @@ info_find_fullpath (char *partial, struct stat *finfo)
fullpath = info_add_extension (0, partial, finfo);
}
- /* Tilde expansion. FIXME: Not needed, because done by shell. */
+ /* Tilde expansion. Could come from user input in echo area. */
else if (partial[0] == '~')
{
partial = tilde_expand_word (partial);
diff --git a/info/session.c b/info/session.c
index cbe4cc3a33..341f3f7af1 100644
--- a/info/session.c
+++ b/info/session.c
@@ -3730,8 +3730,8 @@ enum
DUMP_SYS_ERROR
};
-static int dump_node_to_stream (char *filename, char *nodename,
- FILE *stream, int dump_subnodes);
+static int dump_node_to_stream (FILE_BUFFER *file_buffer,
+ char *nodename, FILE *stream, int dump_subnodes);
static void initialize_dumping (void);
/* Dump the nodes specified with REFERENCES to the file named
@@ -3765,10 +3765,22 @@ dump_nodes_to_file (REFERENCE **references,
/* Print each node to stream. */
for (i = 0; references[i]; i++)
{
- if (dump_node_to_stream (references[i]->filename,
- references[i]->nodename,
- output_stream,
- dump_subnodes) == DUMP_SYS_ERROR)
+ FILE_BUFFER *file_buffer;
+ char *nodename;
+
+ file_buffer = info_find_file (references[i]->filename);
+ if (!file_buffer)
+ {
+ if (info_recent_file_error)
+ info_error ("%s", info_recent_file_error);
+ continue;
+ }
+ if (references[i]->nodename && *references[i]->nodename)
+ nodename = references[i]->nodename;
+ else
+ nodename = "Top";
+ if (dump_node_to_stream (file_buffer, nodename,
+ output_stream, dump_subnodes) == DUMP_SYS_ERROR)
{
info_error (_("error writing to %s: %s"), output_filename,
strerror (errno));
@@ -3796,34 +3808,25 @@ initialize_dumping (void)
If DUMP_SUBNODES is non-zero, recursively dump the nodes which appear
in the menu of each node dumped. */
static int
-dump_node_to_stream (char *filename, char *nodename,
+dump_node_to_stream (FILE_BUFFER *file_buffer,
+ char *nodename,
FILE *stream, int dump_subnodes)
{
register int i;
NODE *node;
- node = info_get_node (filename, nodename);
+ node = info_get_node_of_file_buffer (file_buffer, nodename);
if (!node)
{
- if (info_recent_file_error)
- info_error ("%s", info_recent_file_error);
- else
- {
- if (filename && *nodename != '(')
- info_error (msg_cant_file_node,
- filename_non_directory (filename),
- nodename);
- else
- info_error (msg_cant_find_node, nodename);
- }
+ info_error (msg_cant_find_node, nodename);
return DUMP_INFO_ERROR;
}
/* If we have already dumped this node, don't dump it again. */
if (info_namelist_add (&dumped_already, node->nodename))
{
- free_history_node (node);
+ free (node);
return DUMP_SUCCESS;
}
@@ -3832,7 +3835,7 @@ dump_node_to_stream (char *filename, char *nodename,
if (write_node_to_stream (node, stream))
{
- free_history_node (node);
+ free (node);
return DUMP_SYS_ERROR;
}
@@ -3855,17 +3858,17 @@ dump_node_to_stream (char *filename, char *nodename,
/* We don't dump Info files which are different than the
current one. */
if (!menu[i]->filename)
- if (dump_node_to_stream (filename, menu[i]->nodename,
+ if (dump_node_to_stream (file_buffer, menu[i]->nodename,
stream, dump_subnodes) == DUMP_SYS_ERROR)
{
- free_history_node (node);
+ free (node);
return DUMP_SYS_ERROR;
}
}
}
}
- free_history_node (node);
+ free (node);
return DUMP_SUCCESS;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: More efficient subnode dumping,
Gavin D. Smith <=