From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ED2F03858D3C; Wed, 20 Apr 2022 01:57:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED2F03858D3C From: "demerphq at gmail dot com" To: bzip2-devel@sourceware.org Subject: =?UTF-8?B?W0J1ZyBiemlwMi8yODkwNF0gbGliYnppcDI6IOKAmGNvc3RbM10=?= =?UTF-8?B?4oCZIG1heSBiZSB1c2VkIHVuaW5pdGlhbGl6ZWQgaW4gdGhpcyBmdW5jdGlv?= =?UTF-8?B?biBbLVdtYXliZS11bmluaXRpYWxpemVkXQ==?= Date: Wed, 20 Apr 2022 01:57:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: bzip2 X-Bugzilla-Component: bzip2 X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: demerphq at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nobody at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2022 01:57:13 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28904 --- Comment #3 from demerphq --- On Wed, 20 Apr 2022 at 00:23, mark at klomp dot org wrote: > > https://sourceware.org/bugzilla/show_bug.cgi?id=3D28904 > > --- Comment #2 from Mark Wielaard --- > A different solution might be to use the constant BZ_N_GROUPS instead of = the > variable nGroups when resetting the arrays: > > diff --git a/compress.c b/compress.c > index 5dfa002..2dc5dc1 100644 > --- a/compress.c > +++ b/compress.c > @@ -321,7 +321,7 @@ void sendMTFValues ( EState* s ) > ---*/ > for (iter =3D 0; iter < BZ_N_ITERS; iter++) { > > - for (t =3D 0; t < nGroups; t++) fave[t] =3D 0; > + for (t =3D 0; t < BZ_N_GROUPS; t++) fave[t] =3D 0; > > for (t =3D 0; t < nGroups; t++) > for (v =3D 0; v < alphaSize; v++) > @@ -353,7 +353,7 @@ void sendMTFValues ( EState* s ) > Calculate the cost of this group as coded > by each of the coding tables. > --*/ > - for (t =3D 0; t < nGroups; t++) cost[t] =3D 0; > + for (t =3D 0; t < BZ_N_GROUPS; t++) cost[t] =3D 0; > > if (nGroups =3D=3D 6 && 50 =3D=3D ge-gs+1) { > /*--- fast track the common case ---*/ > > Which might also help the compiler to simply zero the whole (6 element) a= rrays > in one go (the common case), instead of having to check whether nGroups is > smaller in this particular case. I am fine with both of your proposals. I was wondering why you don't use memset() instead of the explicit loop? From what I understand it is faster. Yves --=20 You are receiving this mail because: You are on the CC list for the bug.=