everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: dtas-all@nongnu.org
Subject: [PATCH] dtas-tl: reduce syscalls to speedup `reto' subcommand
Date: Mon,  3 Jul 2023 00:43:09 +0000	[thread overview]
Message-ID: <20230703004309.928292-1-e@80x24.org> (raw)

Syscalls and waiting for responses are expensive, so grab 128
track IDs at once like we do for other subcommands.
 bin/dtas-tl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/dtas-tl b/bin/dtas-tl
index 7659570..45a18b5 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -175,10 +175,10 @@ def add_after(c, argv, last_id)
   time = ARGV[2]
   re = Regexp.quote(re) if fixed
   re = ignorecase ? %r{#{re}}i : %r{#{re}}
-  get_track_ids(c).each do |track_id|
-    res = c.req("tl get #{track_id}")
-    res.sub!(/\A1 \d+=/, '')
-    if re =~ res
+  each_track(c) do |line|
+    line.sub!(/\A(\d+)=/, '')
+    track_id = $1
+    if re =~ line
       req = %W(tl goto #{track_id})
       req << time if time
       res = c.req(req)

                 reply	other threads:[~2023-07-03  0:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230703004309.928292-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=dtas-all@nongnu.org \


* 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.
Code repositories for project(s) associated with this public inbox


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).