From patchwork Sat Aug 25 18:08:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: avih X-Patchwork-Id: 10133 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp4715038jap; Sat, 25 Aug 2018 11:09:12 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb8K+YIcGD2Zq8v9YmgKviCS/0GLfxA1Ov/aWjhYFIBGVR8e5DTiq7f8BKlrsde+7KjkpQC X-Received: by 2002:adf:e846:: with SMTP id d6-v6mr4187796wrn.269.1535220552133; Sat, 25 Aug 2018 11:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535220552; cv=none; d=google.com; s=arc-20160816; b=iPUhYX/RgmXTnyd/K/+uI8FoL1HHu/ebkpvbgIfEeF+EQGfaQR97I0Bi8Ot9XIIJXY 0FlXlfI+rwzCAOOEiUj1ogNAUDdliw8OSLffPk7FJV+Y0RqVdOm7RisyR9TMJWVoH2v3 eE0QCEYrw57FSZplHoY7PXRQEYMLAEFujy8wxY6SHkV1Hj7dhoQL2g3aH6iyx6fwa8n4 8OGW49wN/K2ze1/pWLlQp7+sHfmthHH7rV81xcwEWfFz7Z+TGKhBvDH3SlepX1mFzvlT riFuZCpm15zJm5W8J5FTWXv6Oq4Vpc8cpd4pJnHGvnI/z3fVA5RPMnIEA4Da1o2Veugw poJw== 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=kf3pkVs8CkW/wAzPdCJ5ZA2hKHryfnVJa1T34ZsxVdQ=; b=LKPmN3IaMEELfNZ9OACKdcpz6G6vqlD/j3ACyKI3x9b3DsXpy50+cvy7quE3gwUUx4 ZGlPnJG+FTmHKGcaazE1UR9aGeLSh2q4LQ+cNIOXgpQjZXEwuyxQN9kbgtHzgL9tVE9b tpAaLMXm/mJD0caNvy5ZHHIGWPk6WYHFRDU88NDezebfuc2+OQCJDU6Dt3CAf9Up5q6M 2Y5a1Is+tnt7/HZ0eUiAn9Chu1ORgbg0GYN+x1+XKnh28wkiqwbcYfD97uVReBRaMPFe dOJurxTFaoZ+YntxQ2zyKxiQGaOcWVHFrRARq37rxaRvXHFB/2pMoIetwRX8qg+QJT8g otUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@yahoo.com header.s=s2048 header.b=Vn9yYGm3; 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 k2-v6si3359100wmk.59.2018.08.25.11.09.11; Sat, 25 Aug 2018 11:09:12 -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=Vn9yYGm3; 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 D37BB689A70; Sat, 25 Aug 2018 21:09:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from sonic309-14.consmr.mail.bf2.yahoo.com (sonic309-14.consmr.mail.bf2.yahoo.com [74.6.129.124]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3C9FF680497 for ; Sat, 25 Aug 2018 21:09:01 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1535220536; bh=kCRPDiBclc52Fs34OOTeWFk75yOfUkzTyzy23bBeJfA=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=Vn9yYGm3N4nzqS+gvDDkaH9cQhReLxlVWxOHwT6Bid0gAjG9jjOKybRfiiA7iX6GhKN8EALTejNFVrILbRipe37EdM17vZXs+FEngfOvWu+3rhqZk1p6yFgwtCiNL4x5PnyM/RsnU+bzVZqjVr8qjFIqrvLZ3teK3bSbHCN6E702Q6Mgjv88ssvSYFgLwJTpCZ/Kutv3GmFg2b0xM7h0ohoHErqZRv8bY71aLXu+H3ifqOBVaMEUmOx/Wz5dcyEocDUheECRiFUXpKsOgQjscjXfJi5ibDLmMh7q27TXvJJrOLVTAJMUjfHwsGIN2mNZvnnRIyZCvi2XW9xd52Jbhg== X-YMail-OSG: IP0MpSkVM1m86aH6fjDS60XYRySTE0.OxcGXg3dlHsWr2DddMUbCe5mP3PtEO3l rororgbPcmMSfmbevLX01k1H4AULlUBZ.FMeXa9YIPZBwDelj9cEwaANONQC86SowLgmOi1R5JN7 8s_iqOpgbacJ4TOkuNmh07dwHfq3RctiAkIyIPGkzXrAzprcvPJSfSEB5BdEqlPzPMfyATYGNG1E Ih1VFgyV2.9o4F38iVBv_gO32eTmfgJwb_cSkCOfF2r09lC4WM_g_YdYqEHxTlGPdYscz.KNCJZ5 YGx7xrmeRU5BEjg8HG6utXcIzmddpu3pEFlxBj_RuQAZ3t.91lQNYdssVO40KKEjkK9TLZUI2a2W 9RHs5gzNxRviwDa31u7mKzzJNvGt1xqDMWMY7V0hMVU2uIsY70mqDiNp7pFhhRV.nSiUgutdEdR0 q3hTCN5OVCuRF_PDLwbwNXpebHV5fT_VivcmFiYU5qbzAolvn4f22vNEQzUd8lkRPO.Bo7SqnYhL d91aChSUXbkBd5cvGCQfuWZab.Vhv7u3vB4cp5qJ0tTNAshAbM65m5xqd1VfqRCN2MyoehLEsIOj Lva8SEaIcJk2AJqNagkOhROdSTR2FswuUH.oZh27JZRCiPrTqLFq0URpjxymxdGJj4qQYYlUY6jy Yz4OVs77_eYpNX9zFefM8diWHcz0VJFB0PYMvOOBh8gl2yqRAdPoTxki2BL38R0.rbidCGAzukif lu.bq9siqMqvfcdeJ60V9beoQwF8_gLXyInXqasFBfgzI1Rz.xVz1o0xZbahyXzE2NHzRyKrpXMD TsD4SCP_JPCHeJgeE16l6wQTA33EOJPScy3sJIEiSzGb0HgP2qrhODYnKSNCvtQvy.8Ly9kvJ92B 8eSLc7xRxmv4EO3ymjUUVEuIBwE7UroSiuc2muvvyaTJCQpd91XgxP3QtLUMvS9jy8PcOZot2_Vs NjvCD9CV9N6hrScNSFx4- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.bf2.yahoo.com with HTTP; Sat, 25 Aug 2018 18:08:56 +0000 Date: Sat, 25 Aug 2018 18:08:55 +0000 (UTC) From: avih To: FFmpeg development discussions and patches Message-ID: <996141963.2585533.1535220535147@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 1/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 1/3 which was at "main.patch" of that message. About 50-70% of configure runtime was being spent inside one function: flatten_extralibs() and callees resolve() and unique(). It manipulates strings and invoked nearly 20K (20000) subshells. It was rewritten to avoid subshells, and ended up x50-x250 faster. unique() now outputs a different order: it was keeping the last instance of recurring items, now it keeps the first. It affects libs order at ffbuild/config.{mak,sh} - but I don't think it matters. If it does, "opt1-reorder-unique.patch" restores the original order. Let me know if/why it matters and I'll squash it and update the commit message accordingly if required. 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 94b80da14fbca1296ac744a53581b817ae56d370 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Wed, 1 Aug 2018 09:06:36 +0300 Subject: [PATCH] configure: unique(): fixup to restore original output order Originally unique() was keeping the last occurence of each non-unique item, but commit XXX changed it to keep the first. This commit restores the original order due to *TBD*. --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure b/configure index e9cb7703..ba123ead 100755 --- a/configure +++ b/configure @@ -850,14 +850,27 @@ prepend(){ eval "$var=\"$* \$$var\"" } +reverse () { + eval ' + reverse_out= + for v in $'$1'; do + reverse_out="$v $reverse_out" + done + '$1'=$reverse_out + ' +} + +# keeps the last occurence of each non-unique item unique(){ unique_out= eval unique_in=\$$1 + reverse unique_in for v in $unique_in; do # " $unique_out" +space such that every item is surrounded with spaces case " $unique_out" in *" $v "*) continue; esac # already in list unique_out="$unique_out$v " done + reverse unique_out eval $1=\$unique_out } -- 2.17.1