mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2014-02-09, 10:08   #1
daxmick
 
daxmick's Avatar
 
Feb 2014

22·3·7 Posts
Default PHP vs. Python vs. C (all with GMP)

I've written a PHP script that uses sqlite as a backend database. My goal is to collect "all" the primes starting with 2.

I've done *some* work with PHP and C relating to large numbers, using GMP, but I haven't played with Python any more than printing out "Hello World".

That said, is 1 language better than another? I understand that compiled code executes faster but once the program is loaded into memory aren't they all pretty much the same?
daxmick is offline   Reply With Quote
Old 2014-02-09, 20:54   #2
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17×251 Posts
Default

Quote:
Originally Posted by daxmick View Post
My goal is to collect "all" the primes starting with 2.
There are an infinite number of primes. What are you really trying to do?

Quote:
Originally Posted by daxmick View Post
I've written a PHP script that uses sqlite as a backend database. My goal is to collect "all" the primes starting with 2.

I've done *some* work with PHP and C relating to large numbers, using GMP, but I haven't played with Python any more than printing out "Hello World".

That said, is 1 language better than another? I understand that compiled code executes faster but once the program is loaded into memory aren't they all pretty much the same?
In practice, you might have bottlenecks for various reasons. In the specific context of using GMP, it shouldn't matter much which you use, since I'd assume the bulk of the work is done in the GMP library's code, not in yours.
Mini-Geek is offline   Reply With Quote
Old 2014-02-10, 01:45   #3
daxmick
 
daxmick's Avatar
 
Feb 2014

22·3·7 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
There are an infinite number of primes. What are you really trying to do?

I know that, hence the quotes around "all". My goal is just to start accumulating the primes starting with 2 and going forward till I can no longer go! No real reason other than just to do it.

In practice, you might have bottlenecks for various reasons. In the specific context of using GMP, it shouldn't matter much which you use, since I'd assume the bulk of the work is done in the GMP library's code, not in yours.
That is what I figured too. However, I came across something interesting about PHP GMP. (Damn, I can't find the URL I was reading or I'd post it here.) Anyway, the info was something to the effect that PHP's GMP can only handle 2^31 digits until their new code comes out and then it will be 2^63 digits. (It could have been an old post too bear in mind.)

Not that I plan on reaching either of those limits any time soon but I hadn't seen those limitations in C. Just saying.
daxmick is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Python Diver for GMP-ECM... WraithX GMP-ECM 114 2020-06-18 12:05
Python Coding Help? kelzo Programming 3 2016-11-27 05:16
Python... Xyzzy Programming 20 2009-09-08 15:51
using libecm from python yqiang GMP-ECM 2 2007-04-22 00:14
Help w/ python. a216vcti Programming 7 2005-10-30 00:37

All times are UTC. The time now is 18:08.

Fri Sep 18 18:08:41 UTC 2020 up 8 days, 15:19, 1 user, load averages: 1.73, 1.68, 1.60

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.