From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.3 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3E55C1F8C2 for ; Mon, 22 Dec 2014 01:12:46 +0000 (UTC) Received: from localhost ([::1]:38719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2rYD-0001ON-Iz for dtas-all@80x24.org; Sun, 21 Dec 2014 20:12:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2rY6-0001OG-Qv for dtas-all@nongnu.org; Sun, 21 Dec 2014 20:12:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2rY0-00032P-KR for dtas-all@nongnu.org; Sun, 21 Dec 2014 20:12:38 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:57171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2rY0-00031d-Bk for dtas-all@nongnu.org; Sun, 21 Dec 2014 20:12:32 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 404D51F8A1; Mon, 22 Dec 2014 01:12:31 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] dtas-tl: halve write() syscalls when emitting tracklists Date: Mon, 22 Dec 2014 01:12:28 +0000 Message-Id: <1419210748-26437-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.1.2.571.ged78782.dirty X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Notably, this speeds up "dtas-tl cat" output a little bit. Hrm, Ruby really should be using writev here, we'll need to investigate at a later date. --- bin/dtas-tl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/dtas-tl b/bin/dtas-tl index 6963108..efffa83 100755 --- a/bin/dtas-tl +++ b/bin/dtas-tl @@ -22,18 +22,18 @@ when "cat" get_track_ids(c).each do |track_id| res = c.req("tl get #{track_id}") res.sub!(/\A1 /, '') - puts res + print "#{res}\n" end when "clear" get_track_ids(c).each do |track_id| - puts "#{track_id} " << c.req("tl remove #{track_id}") + print("#{track_id} " << c.req("tl remove #{track_id}") << "\n") end when "addhead" ARGV.shift ARGV.reverse.each do |path| path = File.expand_path(path) res = c.req(%W(tl add #{path})) - puts "#{path} #{res}" + print "#{path} #{res}\n" end when "addtail" ARGV.shift @@ -44,7 +44,7 @@ when "addtail" req = %W(tl add #{path}) req << last_id.to_s if last_id res = c.req(req) - puts "#{path} #{res}" + print "#{path} #{res}\n" last_id = res if res =~ /\A\d+\z/ end when "reto" -- EW