Forums | MacLife
You are not logged in.
#1 2006-04-27 1:26 am
Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
My other site (geekronomicon) has an ongoing "Calculate Pi to n Places" section where people record their times after running a short shell script to time the calculation of Pi to 5000 (or other) places.
After installing Parallels Workstation, I installed Ubuntu Linux and Fedora Core 4 linux distro and decided to test both of them and compare them to my PC and older G4 desktop.
Calculating Pi to 5000 places:
PowerMac (2002 Quicksilver model) Dual 1 Ghz CPUs (Jaguar)
Approx. 9 minutes 1 second
PowerMac (2002 Quicksilver model) Dual 1 Ghz CPUs, (Tiger)
Approx. 2 minutes
Ubuntu on a 3Ghz PC:
Approx 57 seconds
Intel-based MacBookPro at 2Ghz:
Approx. 1 minute 18 seconds
Intel-based MacBookPro running Ubuntu using Parallels Workstation:
Approx. 1minute and 11 seconds
Intel-based MacBook Pro running Fedora Core 4 using Parallels Workstation:
Approx. 1 minute 7 seconds
Amazing that both Ubuntu and Fedora were faster than OS X on the same machine, even taking into consideration that they were running under the Parallels virtualization software.
Offline
#2 2006-04-27 1:30 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
I think this would be a better test with writing an actual C program. That way you have complete control over the algorithm used on all the systems, as well as the compilation. (as in having the same code on all systems, instead of different implementations)
Offline
#3 2006-04-27 1:59 am
- SpacemanSpiff
- Stupendous Man

- From: Transmogrifier
- Registered: 2001-07-31
- Posts: 5536
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
FYI: 58 seconds in OS X on 2.16
"The first time one sees natural beauty which is privately owned; oceans as people's back yards, confounds the senses. I didn't know God had a a toy store for the rich." -- Spanglish
Where forums are fun again: macstack
Offline
#4 2006-04-27 2:15 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
ivanjs wrote:
PowerMac (2002 Quicksilver model) Dual 1 Ghz CPUs (Jaguar)
Approx. 9 minutes 1 second
PowerMac (2002 Quicksilver model) Dual 1 Ghz CPUs, (Tiger)
Approx. 2 minutes
That tells me just about all I need to know about that "benchmark" right there.
,xtG
.tsooJ
Offline
#5 2006-04-27 6:59 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
Alien wrote:
That tells me just about all I need to know about that "benchmark" right there.
,xtG
.tsooJ
Jaguar must have some real problems in the way they implemented the bc calculator language is what I get from that. From 9 minutes in Jaguar to 2 minutes in Tiger is a huge speed dif.
Offline
#6 2006-04-27 7:01 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
SpacemanSpiff wrote:
FYI: 58 seconds in OS X on 2.16
Hey, SS-thanks for the time post. Good time by the way!
Offline
#7 2006-04-27 7:02 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
akb825 wrote:
I think this would be a better test with writing an actual C program. That way you have complete control over the algorithm used on all the systems, as well as the compilation. (as in having the same code on all systems, instead of different implementations)
Well, um, actually it was the same code across all machines... 
Offline
#8 2006-04-27 7:07 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
Here's the shell script if anyone wants to try it:
time bc -q -l << EOF
scale=5000
4*a(1)
quit
EOF
exit 0
There's probably a shorter way to write it, but it worked for my purposes.
Offline
#9 2006-04-27 12:34 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
ivanjs wrote:
akb825 wrote:
I think this would be a better test with writing an actual C program. That way you have complete control over the algorithm used on all the systems, as well as the compilation. (as in having the same code on all systems, instead of different implementations)
Well, um, actually it was the same code across all machines...
No it is not. It is a shell script, which calls a utility. That utility does not necessarily use the same code across all systems. In fact, the fact that other operating systems vary that much across systems tells you that it doesn't use the same code for the utility. This means that this test is 100% BS and highly dependent on the implementation of bc.
For a true test. you would need to make a C program and compile it using GCC, with the same flags across systems. You could use sin/cos/tan type functions. You could either try to imitate what they're using, or you can do something that's simpler to code. (something like calculating sine with a taylor expansion out to a ridiculous number of spaces, etc.)
Offline
#10 2006-04-27 1:25 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
0wnd !! keep up the good work akb 
[MA]NoExit|X| - The good man scorns the wicked.
Offline
#11 2006-04-27 1:40 pm
- The Cynic
- Member

- Registered: 2004-01-25
- Posts: 1934
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
My A64 based pc @2.4Ghz calculates pi to 1M digits in 35 seconds! therefore it must be [...] *whips out calculator* [...] 445.7 times as fast as the Intel-based MacBookPro at 2Ghz!
Offline
#12 2006-04-27 2:32 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
akb825 wrote:
ivanjs wrote:
akb825 wrote:
I think this would be a better test with writing an actual C program. That way you have complete control over the algorithm used on all the systems, as well as the compilation. (as in having the same code on all systems, instead of different implementations)
Well, um, actually it was the same code across all machines...
No it is not. It is a shell script, which calls a utility. That utility does not necessarily use the same code across all systems. In fact, the fact that other operating systems vary that much across systems tells you that it doesn't use the same code for the utility. This means that this test is 100% BS and highly dependent on the implementation of bc.
For a true test. you would need to make a C program and compile it using GCC, with the same flags across systems. You could use sin/cos/tan type functions. You could either try to imitate what they're using, or you can do something that's simpler to code. (something like calculating sine with a taylor expansion out to a ridiculous number of spaces, etc.)
Feel free to write your own-it works for what I was trying to show and all the people who have posted their times so far. It's not an indication of computer speed so no need to get upset.
Last edited by ivanjs (2006-04-27 2:51 pm)
Offline
#13 2006-04-27 2:33 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
NoExit wrote:
0wnd !! keep up the good work akb
Living vicariously, I see...
Offline
#14 2006-04-27 2:44 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
akb825 wrote:
For a true test. you would need to make a C program and compile it using GCC, with the same flags across systems. You could use sin/cos/tan type functions. You could either try to imitate what they're using, or you can do something that's simpler to code. (something like calculating sine with a taylor expansion out to a ridiculous number of spaces, etc.)
But then, on different processors, the code would also be totally different (intel binary vs powerpc binary for example). And since ALL compiled programs compile to different binaries on different platforms, aren't we back to the code being different across platforms?
This is just a simple test showing how the bc calculates at different speeds, not an indication of computer speed.
Offline
#15 2006-04-27 2:50 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
The Cynic wrote:
My A64 based pc @2.4Ghz calculates pi to 1M digits in 35 seconds! therefore it must be [...] *whips out calculator* [...] 445.7 times as fast as the Intel-based MacBookPro at 2Ghz!
Yeah, okay. I want what he has, lol.
Offline
#17 2006-04-27 3:00 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
Alien wrote:
Different (binary) code vs. different algorithm. Big difference.
,xtG
.tsooJ
Yes, yes it is.
Offline
#18 2006-04-27 7:28 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
To clarify, when I was talking about code, I was talking about the algorithm, or more generally, the code that is then translated into machine instructions in the most optimal way possible. (probably written in C, or possibly C++, for bc) That won't change between processors, as the algorithm stays the same. Of course the binary code would be different, as it must be. However, will be comparable. The problem with the script is that you're calling a pre-made algorithm, which would have different C code across OSs. Over the weekend when I have time, I might write some sort of benchmark that can be run completely in the cache. With that, memory speeds would be pretty much moot, as it will benchmark 3 things:
1. the ability of the compiler across the OSs and platforms
2. the speed of the processor itself
3. how quickly the OS switches processes, since unless something is done nearly instantaneously, it isn't going to stay on the processor and cache for the entire runtime of the process.
Offline
#19 2006-04-27 10:48 pm
- Freezer mac
- iPod scroll wheel

- From: next to a big cold lake.
- Registered: 2001-01-06
- Posts: 7370
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
hmmm.. bc only runs on one thread.
it also never uses more than 101.5% of available processing power (where there is 200% available because of 2 processors.)
Offline
#20 2006-04-27 11:33 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
Sometimes running only 1 thread is useful for benchmarking: it tests the speed of the processor itself. The fact that it doesn't use 200% is because of the fact that it only has 1 thread, which means that it can only use 1 CPU. (or core, which is almost the same thing)
Offline
#21 2006-04-28 7:03 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
akb825 wrote:
To clarify, when I was talking about code, I was talking about the algorithm, or more generally, the code that is then translated into machine instructions in the most optimal way possible. (probably written in C, or possibly C++, for bc) That won't change between processors, as the algorithm stays the same. Of course the binary code would be different, as it must be. However, will be comparable. The problem with the script is that you're calling a pre-made algorithm, which would have different C code across OSs. Over the weekend when I have time, I might write some sort of benchmark that can be run completely in the cache. With that, memory speeds would be pretty much moot, as it will benchmark 3 things:
1. the ability of the compiler across the OSs and platforms
2. the speed of the processor itself
3. how quickly the OS switches processes, since unless something is done nearly instantaneously, it isn't going to stay on the processor and cache for the entire runtime of the process.
Ah, thanks for the clarify. That makes more sense.
Still, why would there be such a discrepancy in speed between Jaguar and Tiger? And yes, I ran multiple tests and took an average, though all numbers were within a few hundredths of a second or so.
Would they have rewritten bc? Seems like bc would be standardized at least on the same platform (written in C?). Just curious.
Offline
#22 2006-04-28 11:22 am
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
They come out with new versions of things all the time. They likely use the same version as FreeBSD, or they might have written their own as in Darwin. Regardless, they likely found a better algorithm than what they were using (which was obviously not very good) for, I'm assuming, representing and doing operations on very high precision numbers. If they made their own version for Darwin, though, I wouldn't be surprised that it's not as good as other platforms and is being updated, since it's a rather new OS.
Offline
#23 2006-04-28 1:24 pm
- pottymouth
- Uncreative
- Moderator

- From: JP, MA
- Registered: 2002-02-06
- Posts: 17412
- Website
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
Did anybody go back and check the answers? It doesn't matter how fast your computer calculates pi if it calculates it wrong! I have a red pen if you'd like to borrow it.
Offline
#24 2006-04-28 1:35 pm
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
In this case, the test is speed, not correctness. 
Offline
#25 2006-04-28 1:39 pm
- SpacemanSpiff
- Stupendous Man

- From: Transmogrifier
- Registered: 2001-07-31
- Posts: 5536
Re: Intel MacBook Pro and Older G4 OS Speed Test Calculating Pi
[nerd]..... six nines in a row? That can't be right![/nerd]
"The first time one sees natural beauty which is privately owned; oceans as people's back yards, confounds the senses. I didn't know God had a a toy store for the rich." -- Spanglish
Where forums are fun again: macstack
Offline

