From patchwork Sat Aug 25 18:09:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: avih X-Patchwork-Id: 10136 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp4735288jap; Sat, 25 Aug 2018 11:40:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ8vy8emzogGyvy1GdMScIfRrGNWkQ8iu2uBtYhc6ECF1RrrTeVA6Yq/2hheYpdHFTTWXyp X-Received: by 2002:a5d:4152:: with SMTP id c18-v6mr4479981wrq.61.1535222431378; Sat, 25 Aug 2018 11:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535222431; cv=none; d=google.com; s=arc-20160816; b=aF8qpyqJAEKc0ra6Q2w8kvS4OtfGQ2zI6GaTuXQbaoHJ6Tdhws/9t/pdUILVuoZ5yQ f3dGds6S1NA9kPSJd7Jkv5AqsyxGn7wF0D3GOij2KQ0t1DUxufe3QlP+QGBxYRi9LyGS QtYl7SlleSWJVafAtZIJyCAkM8OMmSARF9XDTCjNxwYoCyTICO3WchWukA7aCq0psDel 1zv+YovEPzOK7z4v9ZlIuXsDqPJFI13uG1YMmXjmbUPRE8SrRMl4TrIRaWT/Wsq7f+aI aQT/4UaO+Sy4VwoMZal4y8Pfucdy4Wf9GD1EwjT/lav7mE2cI+6uJ9AXTEnTvdj3wC8j 73Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:to:from:date :dkim-signature:delivered-to:arc-authentication-results; bh=ybdHAZJHlLb527b5qYcG7PQ43WC/Xw5zRjNThrE5iMA=; b=FCqR9GO2+YKDjuzjUMYqEjksO9OxLISo8vliZo75UkpfJowdCJGL0j0X0eFNYeyQle MvopQ3Qs9RvZmEC5qqvc7Gs/Z6GvmFUJpFfDd18ZPPbc0hV3wBxXVwpk8HFIo2tluUCB g1tDmD/iPvSA2T2fkUXXdSX69jwG9sGxvb7u2vZ0ghSYJMDf5op5shOPzUfWigGZyNK0 1w2+Pfnxm18ziI+EzDDIKKXydOqE6JCniMFS/4n5nSlf1mNBmW/KxqUyUjjbC2ZFGSah P0ZrWTB0cjOvZGwt+USv+uSZcaMpviuF6QQpWUyLNHA6FazZ3ySqM90taXTi2mPRaRIH jVZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@yahoo.com header.s=s2048 header.b=WyxscMKR; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r3-v6si3131083wmc.220.2018.08.25.11.40.31; Sat, 25 Aug 2018 11:40:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@yahoo.com header.s=s2048 header.b=WyxscMKR; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 39AF9689A70; Sat, 25 Aug 2018 21:40:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from sonic304-11.consmr.mail.bf2.yahoo.com (sonic304-11.consmr.mail.bf2.yahoo.com [74.6.128.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 62EDA6806C2 for ; Sat, 25 Aug 2018 21:40:20 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1535222421; bh=8r6AdhizatuaXrbi/cUK//iOP3jazV7J7SyRAkG3giw=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=WyxscMKR37CARLyHn7NCYIizDMY/xO/OqiWC0JHHEiP3Ydkr5Fzt4V4HiHLgua/t71eve0t7yS0IQDNuiCVZ0ZaVtXDDSMgz6zIAP/eMEaQp93JNivWtHn66os2tcyrvOdkePDQlYAE3OK9IG7Q8gjtvUs1sXPlHjb65NHEhBI8HF3GuerwKcsHLmGzpHmNTJHT0uPCFRXuON2huAKm/F0Wd2EO7ILrHvknwGQl2DuopurnC79jVh5sqF9bkBhigEuW2Eq9gOTZUKojpPQBApea3IdPXqlTJMIalvX4u3F3oITyPjADCq5wfMSxbktlM7oR0ix2PGE0nPSj3cUr4KA== X-YMail-OSG: 8BwMAOsVM1n8EtVNaimG17CU56pSE2Nlfu4Thyyyx5U0ZLYLIY5JZ5aFsz7h1Jw JRADzoqrcHtMepWMZhJq5q2soXOArEUC8RuDfEJBx9NfmeqFi26QrEJcHhzo2aIjKQ5beyKDdRPB wR0TjzBV81P1OcJXYHhAGA_FRWkWoHEKe3PO8S7oZ0F20IjD1kZKmkO1RpGFWOFen_gH5ILB4je5 23lQZOkwinD9sf.dXSok2pKTQqzPnsfajlVd9fogBxLvhRarbTNmnikC8P_bfNDpPcHpmUBD4q2P Hrt24kdfZ1ujZOupMusM5xNzRvzYe5GaMTMiOxpAQlvXGXbF_maixRG9yQ96q9C9OQTveceCuWqF T4_yxaHnvW9hqt2BxmD7wS8OPZsi28NpuQnUq3XLdfErbCTqv6NIYmpJHysVEL2JRL0zFe3DN3IA oey1Dxc9vGhbqF9gz8itbxmyakfh00UMmSwFMAg8dU8lssSy8eS4mZRd5I.7.LbI7sD4zsmVts6s 0oPm.KKp8_56F3dCp0jCF6Cb9_zYLUB0ZtGMl3h8hlpMQ6.o69EWB4TXM_46ayVGsNI0BOQ6Z3O5 pUx4lKHhwxVs.BLA6slG3lbraPhpYAGiu96fTRsPrqAZcK_ji.5RcWfIOspg1GAnpyMez8owVNf3 vbONvVcGDp0.shzdFKv1xcWW1Vws_X4TbWj6TlTIBWqUh252Stu2Q1WtWwz3evMft2HZPCdnUpJ4 k89OE3V8XrAKOUAJN2WwQfZVMc0EIeOeklQNYKwclvWkpT0_yylj.Q1fzUpIyuhjYAMFDfiO0I7D 3thy650eESxjgb_J2Hd1ngawfpl9FCyTRm_K4HscZU_EqwY9rKL07mkwKQRkmEnyQXRX02y6m3e3 w1Y3gaKG4hOjaqOsSPCZJ1nctrNugI7StuUWG86WLXR4.beKPtmM6lzHgGbWv9bXQkUVJ98yg1yI fiBHu3nIfgQGDffqFVA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Sat, 25 Aug 2018 18:40:21 +0000 Date: Sat, 25 Aug 2018 18:09:57 +0000 (UTC) From: avih To: FFmpeg development discussions and patches Message-ID: <1713344364.2595687.1535220597888@mail.yahoo.com> In-Reply-To: References: <378315057.2531045.1535207584068.ref@mail.yahoo.com> <378315057.2531045.1535207584068@mail.yahoo.com> MIME-Version: 1.0 X-Mailer: WebService/1.1.12262 YahooMailNeo Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH 2/3] configure: speedup x2-x8 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" For overview see: http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html Attached is patch 2/3 which was at "main.patch" of that message. print_enabled_components() was invoking sed about 350 times on one file. This is never instant but takes many seconds where fork is slow (Windows). Invoke sed only once instead = x4-x10 speedup. On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler wrote: Please use git send-email to send your patches, or at least send each patch, created by git format-patch, as individual attachment. Your files seem to contain multiple patches one after another, which makes them very hard to follow. But nice work! Let's hope this does not cause any regressions. From d1cf17fdb518b3a456bbac61e306599d0a4a7400 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Mon, 30 Jul 2018 22:48:04 +0300 Subject: [PATCH] configure: print_enabled_components(): speedup x4 - x10 Inside print_enabled components, the filter_list case invokes sed about 350 times to parse the same source file and extract different info for each arg. This is never instant, and on systems where fork is slow (notably MSYS2/Cygwin on windows) it takes many seconds. Change it to use sed once on the source file and set env vars with the parse results, then use these results inside the loop. Additionally, the cases of indev_list and outdev_list are very infrequent, but nevertheless they're faster, and arguably cleaner, with shell parameter substitutions than with command substitutions. --- configure | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 465d808d..b74c44e7 100755 --- a/configure +++ b/configure @@ -7224,9 +7224,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h -full_filter_name(){ - sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c -} +# full_filter_name_foo=vf_foo +# full_filter_name_bar=asrc_bar +# ... +eval "$(sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(.*\);/full_filter_name_\2=\1_\2/p" $source_path/libavfilter/allfilters.c)" # generate the lists of enabled components print_enabled_components(){ @@ -7239,13 +7240,13 @@ print_enabled_components(){ if enabled $c; then case $name in filter_list) - c=$(full_filter_name $(remove_suffix _filter $c)) + eval c=\$full_filter_name_${c%_filter} ;; indev_list) - c=$(add_suffix _demuxer $(remove_suffix _indev $c)) + c=${c%_indev}_demuxer ;; outdev_list) - c=$(add_suffix _muxer $(remove_suffix _outdev $c)) + c=${c%_outdev}_muxer ;; esac printf " &ff_%s,\n" $c >> $TMPH -- 2.17.1