473,769 Members | 5,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Benchmark results unrealistic?

Hi!
I've created a benchmark tool which uses Agner Fog's asmlib to count the
clockcycles a function takes. I 'm using it to measure the
MersenneTwister .h speed.
Sourcecode is here:
http://code.google.com/p/multirng/so...s/benchmarks.h
(the main function just calls this functions)
When I run on a P4 Prescott (MinGW with GCC4, Win XP MediaCenter) with
-O3 -fexpensive-optimizations and Prescott-specific optimizations, it
shows me that e.g. mtr.rand() takes ~1200 clockcycles. I think this is
realistic.
But when I write something like

time[0] = ReadTSC();
for(int i = 0;i < NUMTESTS;i++) rand();
time[1] = ReadTSC();

and

cout << "rand() time:" << (time[1]-time[0])/NUMTESTS << endl;

it shows me that it (and the other functions too) takes only 20
clockcycles. Is this realistic? I think it's OK that when you call the
function it takes more clockcycles than in the average, but 20
clockcycles for creating a random number? However, even if I set
NUMTESTS to higher or lower values, the result remains the same (except
of a difference of about 3 or 4 clockcycles)

Thanks in advance, Hans
Feb 11 '08 #1
1 1986
On Feb 11, 3:30 pm, Hans Mull <deyrin...@goog lemail.comwrote :
I've created a benchmark tool which uses Agner Fog's asmlib to count the
clockcycles a function takes. I 'm using it to measure the
MersenneTwister .h speed.
Sourcecode is here:http://code.google.com/p/multirng/so...enchmarks/benc...
(the main function just calls this functions)
When I run on a P4 Prescott (MinGW with GCC4, Win XP MediaCenter) with
-O3 -fexpensive-optimizations and Prescott-specific optimizations, it
shows me that e.g. mtr.rand() takes ~1200 clockcycles. I think this is
realistic.
But when I write something like
time[0] = ReadTSC();
for(int i = 0;i < NUMTESTS;i++) rand();
time[1] = ReadTSC();
and
cout << "rand() time:" << (time[1]-time[0])/NUMTESTS << endl;
it shows me that it (and the other functions too) takes only
20 clockcycles. Is this realistic? I think it's OK that when
you call the function it takes more clockcycles than in the
average, but 20 clockcycles for creating a random number?
That sounds a bit high for the usual implementations of rand(),
yes. But maybe your platform uses something better than the
usual implementations . Which aren't always that good, although
on a 64 bit machine, you can implement a reasonable good RGN
with only 2 cycles of computation. And of course, since it is a
function, you have the overhead of a function call in there. On
some machines, that can be several clock cycles in itself. Plus
the stores to memory, etc.

Of course, clock cycles don't really mean much on a modern
machine anyway. Most modern machines are capable of executing
several instructions in parallel, in a single clock, if there
are no dependencies, where as a rapid sequence of memory
accesses may lead to the memory pipeline staturating, and
several clocks in which no instructions can be executed. The
time it takes to execute rand() in a loop like this is probably
not typical of the time it would take to execute it in normal
program flow.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 12 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
1878
by: Duncan Lissett | last post by:
I'd appreciate any suggestions on how to make faster Python implementations of Richards benchmark. Perhaps there are obvious problems that can be corrected? http://www.lissett.com/ben/bench1.htm
0
2083
by: julio | last post by:
Hello Guys, AlphaServer EV6 processor 500mhz/1Gm memory with Linux mysql> SELECT BENCHMARK(1000000,ENCODE("hello","goodbye")); +----------------------------------------------+ | BENCHMARK(1000000,ENCODE("hello","goodbye")) | +----------------------------------------------+ | 0 |
0
1832
by: Jan Pieter Kunst | last post by:
I recently ran the MySQL benchmark suite on a Dual 1 GHz G4 running Mac OS X Server 10.2.8, and an 800 MHz Intel machine running SuSE Linux 8.0. Both installations used the same my.cnf file. The results are comparable in all benchmarks except one: the 'insert'. In that one, the Mac is more than twice as slow. Below are the benchmark results for boch machines, and the my.cnf I used. I was wondering if there is something I can do,...
6
8465
by: O. Kouame | last post by:
Hi all, Does anyone know where I can find an implementation of the TPC-C benchmark for SQL Server 2000 (preferably written in .NET) ? All I can find is an old Microsoft implementation of TPC-B written in C, and my C skills are rusty to say the least :( Oracle seems to have Hammerora, so maybe someone ported it to SQL Server ? In the worst case, if anyone would be interested in collaborating on writing such an implementation, I'd be more...
2
2655
by: Jan Schäfer | last post by:
Hi all, I want to measure Compiler performance in different C++ abstraction levels on several architectures. I am writing my own benchmark code, implementing the main algorithm I use in my program in different abstraction levels. Now I would like to compare my performance results to a commonly known C++ abstraction benchmark. I think the Stepanov Benchmark would do it, but I can't find it on the web...
74
4606
by: aruna.mysore | last post by:
Hi all, I have a simple definitioin in a C file something like this. main() { char a; ....... int k; }
16
2725
by: Jorge | last post by:
Webkit r34469 vs. Opera 9.50 : 3.00x as fast 6339.6ms(Opera) 2109.8ms (Webkit) ----- FF3.0 (final) vs. Opera 9.50 : 1.94x as fast 6339.6ms (Opera) 3269.6ms (FF3)
0
1276
by: Jon Harrop | last post by:
A JVM developer called John Rose from Sun Microsystems recently claimed on a mailing list that Sun's JVM offers C-like performance whereas .NET only offers performance comparable to old JVM implementations: http://groups.google.com/group/jvm-languages/msg/e8ee4b7f74c93ded I thought I'd test this by running the Java and C# implementations of the commonly-cited SciMark benchmark. At first sight, Sun's JDK 6 was 5% faster than .NET 3.5.
37
2038
by: Jack | last post by:
I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.