Last visit was: It is currently Thu Mar 28, 2024 3:50 pm


All times are UTC-05:00




Post new topic Reply to topic  [75 posts ] 
Author Message
 Post subject:Re: Programming Language Performance
PostPosted:Fri Nov 14, 2008 1:12 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
I wrote a copy of it in Fortran 77 (similar), and here are the results, I used a stopwatch to make sure. I am just lucky seconds() returns a real.

I never really did Fortran before so this was very educational for me.
Fortran doesn't seem to have a fancy printf function, though there are ways to emulate it. I could of made the ouput prettier but really not required.
Code:
Q:\Tools\MinGW>bin\g77 --version GNU Fortran (GCC) 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc. Q:\Tools\MinGW>bin\g77 -o genprime.exe genprime.f
Redid it using realtime pripority:
Code:
Found 250000 primes in 5.078125 (last was 3497861) Found 500000 primes in 13.921875 (last was 7368787) Found 750000 primes in 25.359375 (last was 11381621) Found 1000000 primes in 40.796875 (last was 15485863)


Here is the C version, being on windows it don't necessarily mean my system is twice as slow as Tycho's.
Code:
Found 250000 primes in 3.92188 seconds (last was 3497861) Found 500000 primes in 10.95313 seconds (last was 7368787) Found 750000 primes in 20.28125 seconds (last was 11381621) Found 1000000 primes in 31.25000 seconds (last was 15485863)

Using these, I approximate Fortran to be
Code:
Found 250000 primes in 2.575114 (last was 3497861) Found 500000 primes in 7.059774 (last was 7368787) Found 750000 primes in 12.859723 (last was 11381621) Found 1000000 primes in 20.688070 (last was 15485863)

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Fri Nov 14, 2008 4:25 pm 
Literally Nine
User avatar
 

Joined:Sat Apr 02, 2005 3:31 pm
Posts:1171
Location:The vicinity of an area adjacent to a location.
Can you fork GenPrime on GitHub, add the Fortran .f file, commit, push, and send me a pull request?

_________________
- Tycho

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Fri Nov 14, 2008 6:09 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
To be completely honest I don't know how to use git. Though while I gave it a shot, I do not really want take the time to learn it at this time. If you want a copy of the file I left it on my server here: Get the file

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sat Nov 15, 2008 4:38 pm 
User avatar
 

Joined:Sun Feb 12, 2006 8:56 pm
Posts:1019
Website:http://eddieringle.com
Location:Detroit, MI
I've forked it myself and pushed it for you, Chase. I've also sent Tycho a pull-request.

_________________
-- Eddie Ringle

Check out Elysian Shadows and consider backing us on Kickstarter!

====================================

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sat Nov 15, 2008 5:05 pm 
Literally Nine
User avatar
 

Joined:Sat Apr 02, 2005 3:31 pm
Posts:1171
Location:The vicinity of an area adjacent to a location.
The commit has been pulled, and the new code has been pushed to github.

_________________
- Tycho

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sat Nov 15, 2008 9:40 pm 
User avatar
 

Joined:Sat Jun 03, 2006 3:51 am
Posts:1186
Website:http://griffinhart.livejournal.com/
Yahoo Messenger:Squall591
AOL:FinalWarrior591
Location:Look at my horse, my horse is amazing!
So, I showed this to a friend of mine - who champions Lua - and had him test Lua with GenPrime. His PC's specs are entirely different, of course, and he's not using pure Lua (he's using Löve, but says it shouldn't make too much of a difference). Here are his results:

http://img32.picoodle.com/img/img32/3/1 ... 54e96d.png

According to him, that's with a single core.

-- Griffinhart

_________________
"My word is my honor. My honor is my life."
-- Demonchild, Angelkin, the Blackest Seraph, the Final Warrior

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sat Nov 15, 2008 11:16 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
Must have an error in the program then.

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 12:15 am 
Literally Nine
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:1263
I'm going to agree with Chase on this one. Can we get the code?


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 1:57 am 
User avatar
 

Joined:Sat Jun 03, 2006 3:51 am
Posts:1186
Website:http://griffinhart.livejournal.com/
Yahoo Messenger:Squall591
AOL:FinalWarrior591
Location:Look at my horse, my horse is amazing!
Since I linked him to the FM wiki article on GenPrime, and he said he just rewrote it to fit Lua's syntax... I don't think it's an error. But again, I could be wrong. I'll bug him for the code and give it to you when I get it.

-- Griffinhart

_________________
"My word is my honor. My honor is my life."
-- Demonchild, Angelkin, the Blackest Seraph, the Final Warrior

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 6:12 pm 
User avatar
 

Joined:Sat Jun 03, 2006 3:51 am
Posts:1186
Website:http://griffinhart.livejournal.com/
Yahoo Messenger:Squall591
AOL:FinalWarrior591
Location:Look at my horse, my horse is amazing!
K, here's the sauce: http://rafb.net/p/v8n2Be65.html

Note that this isn't pure Lua; the "load and draw functions are called by Löve", according to my friend.

-- Griffinhart

_________________
"My word is my honor. My honor is my life."
-- Demonchild, Angelkin, the Blackest Seraph, the Final Warrior

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 6:58 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
A decent portion of the isprime function is missing.

I am writing up a copy for the LuaJIT.

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 8:02 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
Some impressive results (atleast on my system) for the LuaJIT. (Mind you not as impressive as the ones that FinalWarrior posted).
Code:
JuaJIT Found 250000 primes in 3.343 seconds (last was 3497861) Found 500000 primes in 9.422 seconds (last was 7368787) Found 750000 primes in 17.297 seconds (last was 11381621) Found 1000000 primes in 26.531 seconds (last was 15485863) Lua Found 250000 primes in 27.265 seconds (last was 3497861) Found 500000 primes in 76.531 seconds (last was 7368787) Found 750000 primes in 140.344 seconds (last was 11381621) Found 1000000 primes in 218.047 seconds (last was 15485863)
I compiled the JIT on my computer, just for reference I ran the c version again
Code:
Found 250000 primes in 3.89063 seconds (last was 3497861) Found 500000 primes in 11.18750 seconds (last was 7368787) Found 750000 primes in 20.59375 seconds (last was 11381621) Found 1000000 primes in 31.87500 seconds (last was 15485863)
Now either the time function in the Lua script is off (I somehow doupt this), or the LuaJIT version is faster then the C version on my system. However I find this somewhat possible if the LuaJIT makes certain platform specific optimizations that are not in the C version.

Therefore I approximate the results to be
Code:
JuaJIT Found 250000 primes in 1.662 seconds (last was 3497861) Found 500000 primes in 4.683 seconds (last was 7368787) Found 750000 primes in 8.598 seconds (last was 11381621) Found 1000000 primes in 13.188 seconds (last was 15485863) Lua Found 250000 primes in 13.552 seconds (last was 3497861) Found 500000 primes in 38.040 seconds (last was 7368787) Found 750000 primes in 69.760 seconds (last was 11381621) Found 1000000 primes in 108.383 seconds (last was 15485863)
I used the same lua script for both the LuaJIT and the default Lua. This just shows just how much JIT does help.

You can download a copy of the script here: Get it here

EDIT:
I discoverd an extra layer of enablable optimization in the jit I got these results by turning it on.
Code:
LuaJIT Found 250000 primes in 3.015 seconds (last was 3497861) Found 500000 primes in 8.578 seconds (last was 7368787) Found 750000 primes in 16 seconds (last was 11381621) Found 1000000 primes in 24.532 seconds (last was 15485863) Approximates to Found 250000 primes in 1.499 seconds (last was 3497861) Found 500000 primes in 4.264 seconds (last was 7368787) Found 750000 primes in 7.953 seconds (last was 11381621) Found 1000000 primes in 12.194 seconds (last was 15485863)
Here is a dump of the asm code it wrote for the optimized version: Get it here

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 8:46 pm 
User avatar
 

Joined:Sat Jun 03, 2006 3:51 am
Posts:1186
Website:http://griffinhart.livejournal.com/
Yahoo Messenger:Squall591
AOL:FinalWarrior591
Location:Look at my horse, my horse is amazing!
Quote:
A decent portion of the isprime function is missing.
Um, what? From what I can tell, all of isPrime is there. Unless I'm reading his loop wrong... (Mind you, I've only had a rudimentary walkthrough with Lua, so I'm not fluent in it.)

-- Griffinhart

ETA: And once again, he's got a different rig. I dun has his hardware specs, though (I'll bother him for those if you guys want me to).

_________________
"My word is my honor. My honor is my life."
-- Demonchild, Angelkin, the Blackest Seraph, the Final Warrior

Image


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Sun Nov 16, 2008 8:54 pm 
User avatar
 

Joined:Mon Sep 22, 2008 9:51 am
Posts:112
I can hardly believe the results myself. <_<

EDIT: GAH, triple post. Delete this.

_________________
Oh this and that.


Top
Offline  
 Post subject:Re: Programming Language Performance
PostPosted:Mon Nov 17, 2008 6:32 am 
User avatar
 

Joined:Sun Feb 12, 2006 8:56 pm
Posts:1019
Website:http://eddieringle.com
Location:Detroit, MI
Quote:
ETA: And once again, he's got a different rig. I dun has his hardware specs, though (I'll bother him for those if you guys want me to).
Yes, bothering is good. :)

_________________
-- Eddie Ringle

Check out Elysian Shadows and consider backing us on Kickstarter!

====================================

Image


Top
Offline  
Display posts from previous: Sort by 
Post new topic Reply to topic

All times are UTC-05:00


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created by Miah with assistance from hyprnova