× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jon Paris wrote:

Hmmm - Barbara would know better - but given that code it is conceivable that the entire content of the FOR loops is completely removed by the optimizer.


I'm not really sure how clever the optimizer is, but in this case it doesn't seem to optimize out the loop content; I get different durations depending on how many iterations I give it.

I was told once a long time ago that performance tests should have enough iterations so the loop takes at least 30 seconds to run, to reduce the impact of any setup (like getting timestamps). I usually set up my performance tests to get the number of iterations as a parameter or from DSPLY, so I can try ever bigger values until I get up to around 30 seconds for at least one of the scenarios.

A million iterations for the multiplication doesn't seem like enough to get anywhere near 30 seconds. It could be the case that most of the time being measured is actually being taken up fetching the timestamps.

In this case, that doesn't seem to be case, though. Running with just one iteration gives a "zero" duration, so the fetching of the timestamps doesn't seem to be significant. There's does seem to be a significant difference between / and *. Interestingly though, on my system, %DIV(num:10000) is almost as fast as multiplication by .00001,
even unoptimized.

Unoptimized, with 50 million iterations:
50000000
DSPLY divide with / : 25.440000
DSPLY divide with %div: 12.351000
DSPLY mult by .00001 : 10.221000

Optimized, with 50 million iterations:
DSPLY divide with / : 17.073000
DSPLY divide with %div: 4.307000
DSPLY mult by .00001 : 4.307000


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.