From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 2063 invoked from network); 13 Aug 1999 04:07:59 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 13 Aug 1999 04:07:59 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id AAA09240 for ; Fri, 13 Aug 1999 00:07:56 -0400 Received: by paralleldata.com from localhost (router,SLMail V2.5); Thu, 12 Aug 1999 23:12:44 -0500 Received: by paralleldata.com from paralleldata.com (207.136.52.246::mail daemon; unverified,SLMail V2.5); Thu, 12 Aug 1999 23:12:42 -0500 Sender: "Wsb" Message-ID: <37B399CF.537B2135@paralleldata.com> Date: Thu, 12 Aug 1999 23:06:39 -0500 From: "Wes Bauske" Organization: PDS Inc. X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: how efficient are functions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Christopher T. Lansdown" wrote: > > Hi, > How efficient are function calls on the Alpha? For small (3-10 > liners) functions, is it a real speed gain to use MACROs instead? Btw, is > there a better place for me to be asking this sort of stuff than this > list? > -Chris > Depends what the code does. If it's C, use a macro or inline the function if you can. Some teachers go overboard with modularization if you ask me. My rule is the subroutine/function has to be at least 100 clock cycles to be separated as a useful routine. So, a routine that has a for/do loop in it can be quite small but qualify to be a separate routine. Otherwise, it would need to be a fair number of statements to be separated. The key is to understand the overhead cost in clock cycles and compare it to the work the routine will do. Then you just decide how much overhead you want to tolerate. Of course, this assumes you're willing to read a little ASM to see what the generated code looks like. Otherwise, figure your average statement "a=b+c" involves 2 loads, an add, and a store. Ignoring pipelining/memory effects, thats 4 clocks. Doing this, you can figure out how much work your routine does, at least approximately. Of course, if you only call the routine once or twice, it won't matter anyway. This all only gets interesting when the code is in your main computing path. Wes