From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phillip Susi Subject: Re: [PATCH 1/1] fat: improve sync performance by grouping writes revised again Date: Wed, 01 Nov 2006 15:52:09 -0500 Message-ID: <454908F9.80905@cfl.rr.com> References: <4548C8AE.2090603@pigscanfly.ca> <20061101164715.GC16154@wohnheim.fh-wedel.de> <20061101202400.GA6888@wohnheim.fh-wedel.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Holden Karau , Josef Sipek , hirofumi@mail.parknet.co.jp, linux-kernel@vger.kernel.org, Holden Karau , "akpm@osdl.org" , linux-fsdevel@vger.kernel.org, Nick Piggin , Matthew Wilcox Return-path: Received: from iriserv.iradimed.com ([69.44.168.233]:47425 "EHLO iradimed.com") by vger.kernel.org with ESMTP id S1752360AbWKAUvx (ORCPT ); Wed, 1 Nov 2006 15:51:53 -0500 To: =?ISO-8859-1?Q?J=F6rn_Engel?= In-Reply-To: <20061101202400.GA6888@wohnheim.fh-wedel.de> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org I think this is getting into micro-optimization, which is usually bad.=20 Also moving the assignment of err outside the body of the if only=20 results in slightly faster code in the case where there is an error,=20 since you can test and _maybe_ conditionally jump directly to the error= :=20 label if it is not very far away. With the assignment in the body, the= =20 conditional jump must jump to the assignment followed by an=20 unconditional jump to the label. In other words, the only time this micro optimization will be of benefi= t=20 is if you are erroring out most of the time rather than only under=20 exceptional conditions, AND the error label isn't too far away for a=20 conditional branch to reach. In other words, just don't do it ;) J=F6rn Engel wrote: > On Wed, 1 November 2006 13:02:12 -0500, Holden Karau wrote: >> On 11/1/06, J=F6rn Engel wrote: >>> Result would be something like: >>> c_bh =3D kmalloc(... >>> err =3D -ENOMEM; >>> if (!c_bh) >>> goto error; >> That wouldn't work so well since we always return err, >=20 > I don't quite follow. If the branch is taken, err is -ENOMEM. If th= e > branch is not taken, err is set to 0 with the next instruction. >=20 > Both methods definitely work. Whether one is preferrable over the > other is imo 90% taste and maybe 10% better code on some architecture= =2E > So just pick what you prefer. >=20 > J=F6rn >=20 - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html