[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT):
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT): Contain ASSOCIATED_INFO structures as subfields rather than as pointers outside the structure. This avoids having to allocate these objects separately and may improve memory cache performance. * tp/Texinfo/XS/parsetexi/tree.c (alloc_associated_info) (new_associated_info): Remove. (destroy_associated_info): Do not free the ASSOCIATED_INFO object itself. (destroy_element): Call destroy_associated_info to free other storage. |
Date: |
Mon, 10 Apr 2023 14:18:13 -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 75b6628fb2 * tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT): Contain
ASSOCIATED_INFO structures as subfields rather than as pointers outside the
structure. This avoids having to allocate these objects separately and may
improve memory cache performance. * tp/Texinfo/XS/parsetexi/tree.c
(alloc_associated_info) (new_associated_info): Remove.
(destroy_associated_info): Do not free the ASSOCIATED_INFO object itself.
(destroy_element): Call destroy_associated_info to free other storage.
75b6628fb2 is described below
commit 75b6628fb2d382a49ba62c17a72e298a4b80eef4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Apr 10 19:18:05 2023 +0100
* tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT):
Contain ASSOCIATED_INFO structures as subfields rather than
as pointers outside the structure. This avoids having to
allocate these objects separately and may improve memory cache
performance.
* tp/Texinfo/XS/parsetexi/tree.c (alloc_associated_info)
(new_associated_info): Remove.
(destroy_associated_info): Do not free the ASSOCIATED_INFO
object itself.
(destroy_element): Call destroy_associated_info to free other
storage.
---
ChangeLog | 14 ++++++++++++++
tp/Texinfo/XS/parsetexi/api.c | 4 ++--
tp/Texinfo/XS/parsetexi/close.c | 2 +-
tp/Texinfo/XS/parsetexi/extra.c | 31 ++++++++++++++++---------------
tp/Texinfo/XS/parsetexi/tree.c | 31 +++++--------------------------
tp/Texinfo/XS/parsetexi/tree_types.h | 4 ++--
6 files changed, 40 insertions(+), 46 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b5c32a3a2f..cd5942f7c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-04-10 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT):
+ Contain ASSOCIATED_INFO structures as subfields rather than
+ as pointers outside the structure. This avoids having to
+ allocate these objects separately and may improve memory cache
+ performance.
+ * tp/Texinfo/XS/parsetexi/tree.c (alloc_associated_info)
+ (new_associated_info): Remove.
+ (destroy_associated_info): Do not free the ASSOCIATED_INFO
+ object itself.
+ (destroy_element): Call destroy_associated_info to free other
+ storage.
+
2023-04-10 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/parsetexi/api.c (build_single_index_data):
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 12362a1e5c..c3ca65cb8f 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -614,8 +614,8 @@ element_to_perl_hash (ELEMENT *e)
hv_store (e->hv, "text", strlen ("text"), sv, HSH_text);
}
- store_additional_info (e, e->extra_info, "extra");
- store_additional_info (e, e->info_info, "info");
+ store_additional_info (e, &e->extra_info, "extra");
+ store_additional_info (e, &e->info_info, "info");
store_source_mark_list (e);
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 035d8ef41e..70021d68cd 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -108,7 +108,7 @@ is_container_empty (ELEMENT *current)
if (current->contents.number == 0
&& current->args.number == 0
&& current->text.end == 0
- && current->info_info->info_number == 0)
+ && current->info_info.info_number == 0)
return 1;
return 0;
}
diff --git a/tp/Texinfo/XS/parsetexi/extra.c b/tp/Texinfo/XS/parsetexi/extra.c
index 90ad6dfc1d..9e37e5346c 100644
--- a/tp/Texinfo/XS/parsetexi/extra.c
+++ b/tp/Texinfo/XS/parsetexi/extra.c
@@ -50,7 +50,7 @@ add_associated_info_key (ASSOCIATED_INFO *a, char *key,
intptr_t value,
void
add_extra_element (ELEMENT *e, char *key, ELEMENT *value)
{
- add_associated_info_key (e->extra_info, key,
+ add_associated_info_key (&e->extra_info, key,
(intptr_t) value, extra_element);
}
@@ -61,14 +61,14 @@ add_extra_element (ELEMENT *e, char *key, ELEMENT *value)
void
add_extra_element_oot (ELEMENT *e, char *key, ELEMENT *value)
{
- add_associated_info_key (e->extra_info,
+ add_associated_info_key (&e->extra_info,
key, (intptr_t) value, extra_element_oot);
}
void
add_info_element_oot (ELEMENT *e, char *key, ELEMENT *value)
{
- add_associated_info_key (e->info_info,
+ add_associated_info_key (&e->info_info,
key, (intptr_t) value, extra_element_oot);
}
@@ -77,7 +77,7 @@ add_info_element_oot (ELEMENT *e, char *key, ELEMENT *value)
void
add_extra_contents (ELEMENT *e, char *key, ELEMENT *value)
{
- add_associated_info_key (e->extra_info,
+ add_associated_info_key (&e->extra_info,
key, (intptr_t) value, extra_contents);
}
@@ -86,47 +86,48 @@ add_extra_contents (ELEMENT *e, char *key, ELEMENT *value)
void
add_extra_text (ELEMENT *e, char *key, ELEMENT *value)
{
- add_associated_info_key (e->extra_info, key, (intptr_t) value, extra_text);
+ add_associated_info_key (&e->extra_info, key, (intptr_t) value, extra_text);
}
void
add_extra_misc_args (ELEMENT *e, char *key, ELEMENT *value)
{
if (!value) return;
- add_associated_info_key (e->extra_info,
+ add_associated_info_key (&e->extra_info,
key, (intptr_t) value, extra_misc_args);
}
void
add_extra_string (ELEMENT *e, char *key, char *value)
{
- add_associated_info_key (e->extra_info, key, (intptr_t) value, extra_string);
+ add_associated_info_key (&e->extra_info, key,
+ (intptr_t) value, extra_string);
}
void
add_info_string (ELEMENT *e, char *key, char *value)
{
- add_associated_info_key (e->info_info, key, (intptr_t) value, extra_string);
+ add_associated_info_key (&e->info_info, key, (intptr_t) value, extra_string);
}
void
add_extra_string_dup (ELEMENT *e, char *key, char *value)
{
- add_associated_info_key (e->extra_info,
+ add_associated_info_key (&e->extra_info,
key, (intptr_t) strdup (value), extra_string);
}
void
add_info_string_dup (ELEMENT *e, char *key, char *value)
{
- add_associated_info_key (e->info_info,
+ add_associated_info_key (&e->info_info,
key, (intptr_t) strdup (value), extra_string);
}
void
add_extra_integer (ELEMENT *e, char *key, long value)
{
- add_associated_info_key (e->extra_info,
+ add_associated_info_key (&e->extra_info,
key, (intptr_t) value, extra_integer);
}
@@ -146,7 +147,7 @@ ELEMENT *
lookup_extra_element (ELEMENT *e, char *key)
{
KEY_PAIR *k;
- k = lookup_associated_info (e->extra_info, key);
+ k = lookup_associated_info (&e->extra_info, key);
if (!k)
return 0;
return (ELEMENT *) k->value;
@@ -155,14 +156,14 @@ lookup_extra_element (ELEMENT *e, char *key)
KEY_PAIR *
lookup_extra (ELEMENT *e, char *key)
{
- return lookup_associated_info (e->extra_info, key);
+ return lookup_associated_info (&e->extra_info, key);
}
ELEMENT *
lookup_info_element (ELEMENT *e, char *key)
{
KEY_PAIR *k;
- k = lookup_associated_info (e->info_info, key);
+ k = lookup_associated_info (&e->info_info, key);
if (!k)
return 0;
return (ELEMENT *) k->value;
@@ -172,6 +173,6 @@ lookup_info_element (ELEMENT *e, char *key)
KEY_PAIR *
lookup_info (ELEMENT *e, char *key)
{
- return lookup_associated_info (e->info_info, key);
+ return lookup_associated_info (&e->info_info, key);
}
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index ad3b2689b6..4baffb0be1 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -94,24 +94,6 @@ static ELEMENT *alloc_element (void)
return (ELEMENT *) obstack_alloc (&obs_element, sizeof (ELEMENT));
}
-static ASSOCIATED_INFO *alloc_associated_info (void)
-{
- return (ASSOCIATED_INFO *) obstack_alloc
- (&obs_element, sizeof (ASSOCIATED_INFO));
-}
-
-
-ASSOCIATED_INFO *
-new_associated_info (void)
-{
- ASSOCIATED_INFO *info = alloc_associated_info ();
-
- info->info_number = 0;
- info->info_space = 0;
- info->info = 0;
- return info;
-}
-
ELEMENT *
new_element (enum element_type type)
{
@@ -132,8 +114,8 @@ new_element (enum element_type type)
e->contents.number = 0;
e->parent = 0;
- e->extra_info = new_associated_info();
- e->info_info = new_associated_info();
+ e->extra_info.info = 0;
+ e->info_info.info = 0;
e->source_mark_list.space = 0;
e->source_mark_list.number = 0;
@@ -169,8 +151,6 @@ destroy_associated_info (ASSOCIATED_INFO *a)
}
}
free (a->info);
-
- free (a);
}
void
@@ -205,12 +185,11 @@ destroy_element (ELEMENT *e)
free (e->contents.list);
free (e->args.list);
- /* freed in reset_obstacks */
- /* destroy_associated_info (e->extra_info); */
- /* destroy_associated_info (e->info_info); */
-
destroy_source_mark_list (&(e->source_mark_list));
+ destroy_associated_info (&e->extra_info);
+ destroy_associated_info (&e->info_info);
+
/* freed in reset_obstacks */
/* free (e); */
}
diff --git a/tp/Texinfo/XS/parsetexi/tree_types.h
b/tp/Texinfo/XS/parsetexi/tree_types.h
index aedbeaccaa..f586f26d6a 100644
--- a/tp/Texinfo/XS/parsetexi/tree_types.h
+++ b/tp/Texinfo/XS/parsetexi/tree_types.h
@@ -105,8 +105,8 @@ typedef struct ELEMENT {
struct ELEMENT *parent;
SOURCE_INFO source_info;
- ASSOCIATED_INFO *extra_info;
- ASSOCIATED_INFO *info_info;
+ ASSOCIATED_INFO extra_info;
+ ASSOCIATED_INFO info_info;
SOURCE_MARK_LIST source_mark_list;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/tree_types.h (ELEMENT): Contain ASSOCIATED_INFO structures as subfields rather than as pointers outside the structure. This avoids having to allocate these objects separately and may improve memory cache performance. * tp/Texinfo/XS/parsetexi/tree.c (alloc_associated_info) (new_associated_info): Remove. (destroy_associated_info): Do not free the ASSOCIATED_INFO object itself. (destroy_element): Call destroy_associated_info to free other storage.,
Gavin D. Smith <=