[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: isreal benchmarking
From: |
Rik |
Subject: |
Re: isreal benchmarking |
Date: |
Tue, 11 Sep 2012 09:43:54 -0700 |
On 09/10/2012 04:02 PM, Daniel J Sebald wrote:
>> Incidentally, I did a little benchmarking and automatic narrowing is ~25%
>> faster than using an equivalent vectorized operator.
>>
>> Example code:
>> x = complex (ones (1e4), zeros (1e4));
>>
>> tic; xreal = isreal ([x]); toc
>> Elapsed time is 1.78048 seconds.
>>
>> tic; xreal = all (imag (x) == 0); toc
>> Elapsed time is 2.42 seconds.
>
> That's not what I'm getting...
>
> octave:1> x = complex (ones (1e4), zeros (1e4));
> octave:2>
> octave:2> cpustart = cputime();
> octave:3> xisreal = isreal(x)
> xisreal = 0
> octave:4> cputime() - cpustart
> ans = 0.0029990
> octave:5>
> octave:5> cpustart = cputime();
> octave:6> xisreal = isreal([x])
> xisreal = 1
> octave:7> cputime() - cpustart
> ans = 1.5658
> octave:8>
> octave:8> cpustart = cputime();
> octave:9> xisreal = isreal(x(:))
> xisreal = 1
> octave:10> cputime() - cpustart
> ans = 1.5678
> octave:11>
> octave:11> cpustart = cputime();
> octave:12> xisreal = all (all (imag (x) == 0))
> xisreal = 1
> octave:13> cputime() - cpustart
> ans = 1.4528
>
> What brand of computer do you have there Rik?
Hmm. It's not that bad. I'm using a mainstream Intel Core2 Duo.
Benchmarking though can be tricky. Did you disable frequency scaling for
your CPU? If not, the first tests impose a load on the CPU which then
responds by increasing its operating frequency and later tests run faster.
There wasn't a sudden change in system load during the test was there such
as a cron job coming to life?
I just re-benchmarked using your exact code and I still get the result that
narrowing is faster. This is on a development build from about a week ago.
--Rik
- isreal and iscomplex, Rik, 2012/09/10
- Re: isreal and iscomplex, Daniel J Sebald, 2012/09/10
- Re: isreal benchmarking,
Rik <=
- Re: isreal benchmarking, Daniel J Sebald, 2012/09/11
- Re: isreal benchmarking, John W. Eaton, 2012/09/11
- Message not available
- Message not available
- Message not available
- Re: isreal benchmarking, John W. Eaton, 2012/09/11
- Re: isreal benchmarking, Daniel J Sebald, 2012/09/11
- Re: isreal benchmarking, John W. Eaton, 2012/09/12
- Re: isreal benchmarking, Daniel J Sebald, 2012/09/12