From: Daniel Kiper Subject: Re: [PATCH v4 3/4] libxl: Some optimizations in libxl_set_memory_target() Date: Tue, 30 Apr 2013 14:23:12 +0200 Message-ID: <20130430122312.GA9904@debian70-amd64.local.net-space.pl> References: <1367233779-8202-1-git-send-email-daniel.kiper@oracle.com> <1367233779-8202-4-git-send-email-daniel.kiper@oracle.com> <1367234203.3142.272.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1367234203.3142.272.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Ian Jackson , "konrad.wilk@oracle.com" List-Id: xen-devel@lists.xenproject.org On Mon, Apr 29, 2013 at 12:16:43PM +0100, Ian Campbell wrote: > On Mon, 2013-04-29 at 12:09 +0100, Daniel Kiper wrote: > > Some optimizations in libxl_set_memory_target(). > > Please describe them in the commit message. OK. > At first glance it just looks like you are renaming some variables from > "memmax"/"target"/"uuid" to "s", why? Just to reduce the number of local > variables? > > They seem more meaningful and easier to read with their current names > and if you are "optimising" the use of local variable then that seems > like a false optimisation to me -- any modern compiler can surely work > out that the lifetimes of these various things do not overlap and do the > sensible thing WRT register allocation. > > At the very least this renaming is hiding what you are actually doing. Here are four things: - reduction of number of variables which you found, - removal of unneeded intialization; probably it was needed some time ago but now it is not, - removal of memorykb = new_target_memkb assignment with relevant changes in other places, - merge of video memory size calculation which is currently in two places. I do not insist on first thing but I think that other optimizations are worth to do. If you wish I could do all of them in separate patches. Daniel