I mentioned a few weeks ago about a memory problem that could not be solved due to the programming taking alot of memory.

Now what am I to do?

Anyway to expand the use of the memory or should I just use java? but will it have the same problem?

For those who dont remember, I am making a program for a family friend that requires 'prolly in the millions' of calculation to occur and then produce someoutput.

As you could guess i use nested for loops, etc.

So any ideas?

Thanks, Regards X

Recommended Answers

All 10 Replies

I would recommend to use Java with Tomcat server. I'm not sure what will be reaction of PHP community. Would be Apache able to handle such requests from PHP?

I havent used java since university.

Back in the day it was just straight up text editor and then ran it in a java compiler program.

So dont quite understand what you meant by tomcat server. Also would you happen to know the memory limitation of java?

Cause it would make sense java memory > php memory but before I start prefer to have statistics.

Thanks, Regards X

I presumed you wanted to run this as web service, which would require Tomcat server to run JSP and servlets.
However, if you intending to create just simple Java application only JRE is required to run this application (JDK for development off course)

Na I can make it just a program and then just pass it around to the family, no biggy.

Only memory is my problem :(.

So any ideas/statistics, before I go ahead?

Thanks, Regards X

for($i=0;$i<100000;$i++) {
 for($j=$i;$j<10000;$j++) {
     echo "i is ".$i." j is ".$j."<br />";
}
}

wouldn't it take as much resource in java as it takes in php to execute the above code ? won't it take 1 byte for int and 2 for a character ? :-/ Just wondering!

Difficult to judge as I never compared performance of these two approaches. Also description of the problem is not the strongest

For those who dont remember, I am making a program for a family friend that requires 'prolly in the millions' of calculation to occur and then produce someoutput.

There are alot of calculations I dont know how to describe it :P

Think of it as this

5 for loops nested which each go through 50 iterations each so 50^5.

Then ontop of that all output is then put through 20-30 if statements.

Then after I think there is final output.

I want to know the best way to apporach the problem.

:(

Do you want to use it just for plain calculation on pre-defined formulas or you expect some other functionality out of this project? Retrieve data from a source, store the output in DB, forward data etc.

Na predifned formulas with predifned input.

Just alot of simple math really.

All predinfed no new variables would be need to be inputed or introduced.

Just run the script and retrieve the output.

That simple.

Java stand alone application would be better as it will cost you and your friends nothing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.