Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Replace, ReplaceAll and If time performace comparition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127064] Re: Replace, ReplaceAll and If time performace comparition
  • From: awnl <awnl at gmx-topmail.de>
  • Date: Thu, 28 Jun 2012 03:59:57 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206240826.EAA08423@smc.vnet.net> <201206250801.EAA15438@smc.vnet.net> <jseetb$i34$1@smc.vnet.net>

Hi,

> As you can see Clip can still be topped by a factor 1.45 by using
> procedural and compiled code
> (for me the most interesting enhancements in Mathematica 8).

that seems to be somewhat dependent on your setup (hardware, OS, 
compiler ...). For me the compiled versions are slightly slower than 
Clip (with MS compiler on Windows 7 64bit). As the code is so simple I 
wouldn't expect that a compiler would have much chance to do good or bad 
optimizing it, but still, probably your compiler is doing a better job 
than mine :-).

> What I found surprising is that cf2 ("Speed") is slower than cf1
> ("Quality") and cf0. I also
> did not increase the performance when parallelizing (use
> Parallelization->True).

that is strange indeed, I see the same thing. I have seen large 
differences in other cases, but probably that's because most of those 
options are irrelevant for the code that's run (no danger of 
underflow/overflow etc.). For the parallelization: I think this will 
only have an effect if you make your compiled function Listable and the 
function "threads over list arguments". Rewriting your function that way 
(avoiding the Do-loop) turns out to be a performance disaster, though :-)

> By the way,
> the ranking between cf1, cf0 is just an incidence . They are of the same
> performance (on my PC).
>
> Can anyone top the result?

not me, I won't even try. And I won't buy a better compiler to proof a 
point :-)

albert



  • Prev by Date: An easier functional way to divide each Column of matrix by a row vector, element-wise?
  • Next by Date: Re: Approximate Zero Times A Symbol
  • Previous by thread: Re: Replace, ReplaceAll and If time performace comparition
  • Next by thread: Re: Replace, ReplaceAll and If time performace comparition