[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] dtas-tl: reduce syscalls to speedup `reto' subcommand
From: |
Eric Wong |
Subject: |
[PATCH] dtas-tl: reduce syscalls to speedup `reto' subcommand |
Date: |
Mon, 3 Jul 2023 00:43:09 +0000 |
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] dtas-tl: reduce syscalls to speedup `reto' subcommand,
Eric Wong <=