From: Alex Tran <alex.t.tran@gmail.com>
To: robh@kernel.org, saravanak@google.com
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Alex Tran <alex.t.tran@gmail.com>
Subject: [PATCH] scripts/dtc/flattree.c: stringtable_insert optimization
Date: Thu, 21 Aug 2025 23:04:17 -0700 [thread overview]
Message-ID: <20250822060417.52935-1-alex.t.tran@gmail.com> (raw)
Increment string by string instead of character by character.
Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
---
scripts/dtc/flattree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
index 1bcd8089c5b9..156ca5da89b2 100644
--- a/scripts/dtc/flattree.c
+++ b/scripts/dtc/flattree.c
@@ -222,9 +222,7 @@ static int stringtable_insert(struct data *d, const char *str)
{
unsigned int i;
- /* FIXME: do this more efficiently? */
-
- for (i = 0; i < d->len; i++) {
+ for (i = 0; i < d->len; i += strlen(d->val + i) + 1) {
if (streq(str, d->val + i))
return i;
}
--
2.50.1
next reply other threads:[~2025-08-22 6:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 6:04 Alex Tran [this message]
2025-08-22 13:34 ` [PATCH] scripts/dtc/flattree.c: stringtable_insert optimization Rob Herring
2025-08-23 7:26 ` Alex Tran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250822060417.52935-1-alex.t.tran@gmail.com \
--to=alex.t.tran@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).