Prev: preventing "out-of-memory" by codistributing arrays
Next: Global Variables Speed vs. Function Argument Variable Speed
From: Uwe Brauer on 16 Feb 2010 06:11 Hello I know about profile but is there any other tool available to measure whether the code is efficient. Clock? Tic? Uwe Brauer
From: Rune Allnor on 16 Feb 2010 06:19 On 16 Feb, 12:11, Uwe Brauer <o...(a)mat.ucm.es> wrote: > Hello > > I know about profile but is there any other tool available > to measure whether the code is efficient. Clock? Tic? Define what you mean by 'efficient': - Run time? - Memory footprint? - Maintenance costs? - Time to development? Rune
From: Uwe Brauer on 16 Feb 2010 06:40 >>>>> On Tue, 16 Feb 2010 03:19:12 -0800 (PST), Rune Allnor <allnor(a)tele.ntnu.no> wrote: > On 16 Feb, 12:11, Uwe Brauer <o...(a)mat.ucm.es> wrote: >> Hello >> >> I know about profile but is there any other tool available >> to measure whether the code is efficient. Clock? Tic? > Define what you mean by 'efficient': > - Run time? > - Memory footprint? A combination of these two. Uwe
From: Rune Allnor on 16 Feb 2010 07:06 On 16 Feb, 12:40, Uwe Brauer <o...(a)mat.ucm.es> wrote: > >>>>> On Tue, 16 Feb 2010 03:19:12 -0800 (PST), Rune Allnor <all...(a)tele.ntnu.no> wrote: > > > On 16 Feb, 12:11, Uwe Brauer <o...(a)mat.ucm.es> wrote: > >> Hello > >> > >> I know about profile but is there any other tool available > >> to measure whether the code is efficient. Clock? Tic? > > > Define what you mean by 'efficient': > > > - Run time? > > - Memory footprint? > A combination of these two. If such factors matter at all - forget about matlab. Matlab is an interpreted language that expresses everything and anything in terms of matrices and arrays. Being interpreted means that a lot of stuff has to be checked at run-time (like the number and types of arguments to functions) that a compiled language would check at compile time. Matrix semantics means that one's choise of dat astructures is seriously restricted, in turn meaning that a number of common tasks are implemented very inefficiently. The one area where matlab actually has a forte is linear algebra. If your application is dominated by linear algebra operations, mtlab is hard to beat. However, that advantage is all too often countered by its inefficiency in all the other aspects of computing. I use C++ for the heavy-duty work. It is not uncommon to find C++ programs to be a factor 10 - 50 -100 faster than the matlab counterpart, depending on what the program does. Rune
From: Uwe Brauer on 16 Feb 2010 07:26
>>>>> On Tue, 16 Feb 2010 04:06:50 -0800 (PST), Rune Allnor <allnor(a)tele.ntnu.no> wrote: >> >> � �> - Run time? >> � �> - Memory footprint? >> A combination of these two. > If such factors matter at all - forget about matlab. Well yes and no. I agree with what you say but I am bound to Matlab, since it is much easier to code for numerical work (at least this is my impression) and can be easier debugged, has nice graphical interface and a lot of built in functions. > Matlab is an interpreted language that expresses everything > and anything in terms of matrices and arrays. So let me rephrase my original question then: In the matlab environment, what are the most common errors to be avoided in order that the code does not get to un efficient? > I use C++ for the heavy-duty work. It is not uncommon to > find C++ programs to be a factor 10 - 50 -100 faster than > the matlab counterpart, depending on what the program does. Ok if that is for say 3 dimensional partial diff eq matlab is not for you, but frankly C and relatives I find sort of .... Ok I don't want to start a flame war. Uwe |