Afaik, assembly language is translated into machinecode..Originally Posted by Ren
| SitePoint Sponsor |


Afaik, assembly language is translated into machinecode..Originally Posted by Ren
Hmm, wouldn't call machine code "intermediate form" as that implies there is something else its get translated into.Originally Posted by timvw





> assembly language is translated into machinecode..
That is true, pretty much so; Anything below that then you are talking electrical signals I suppose
> Hmm, wouldn't call machine code "intermediate form" as that implies there is something else its get
> translated into.
I think the point being made, is that for the human it's easier to work with assembler, than it is to work at the machine level; Machine code is basically hexadecimal codes that represent their binary form, ie
Which is better... Hexadecimal - or just decimal if you prefer - or assembler...Code:#c9 201 ret





I prefer to code in binary. It's a pain to debug, but the speed is blistering.





11001001




There are 10 kinds of programers. Those who can count in binary and those who can't.





Which kind of leaves you -BEEP- basically, as counting in binary amounts to base 10 anyways... For those who are looking for an arguement though, hexadecimal isn't counted by a group of 8 binary digits, it's counted in a group of four, for those who don't know![]()



Glad to see we're all still on topic :]
Originally Posted by Dr Livingston


for me PHP still the best!
Yes I know, but it's not any more is it?Originally Posted by BerislavLopac
![]()
Java is still too heavy for any normal system. And I'm not just talking about RAM use.
PHP is still my number one choice.




You have no idea what you are talking about. Speak from experience not.....you know.Java is still too heavy for any normal system. And I'm not just talking about RAM use.
i guess to add fuel the to fire, how would one compare tomcat JSP vs. PHP?




Compare them in what sense? In terms of memory usage? Speed? Given the topic of the thread I'll assume you mean speed. From my experience JSP (in tomcat or another servlet container) is dramatically faster than PHP out of the box (i.e. with no opcode caching etc). If you use some opcode cache with PHP then JSP ends up being around 10-50% faster (depending on what you are doing).how would one compare tomcat JSP vs. PHP?


I once did some basic benchmarks between popular platforms, including those two, and found that each had its own sweet spot.Originally Posted by rockit
For simple stuff like inserting a few dynamic bits in a single page the fastest times were JSP on Resin server, followed by apache/mod_php and then Tomcat JSP and finally mod_perl. (RoR wasn't on the scene yet) Frankly differences were fairly moot. i.e. You probably wouldn't chose one of those technologies over the other based on speed.
I didn't have eaccelerator or any other optimizer installed for PHP either so while it is likely you could tweak this test to put PHP on top by some tiny margin, JSP on Resin was awfully fast and even mod_perl was acceptible so who cares?
I had another test (somewhat ridiculous) that processed enormous strings of several megabytes. Grandpa Perl tore through it like nothing even when entire 5MB+ strings were passed as single variables. PHP definitely lugged a bit. Java crashed.
I rewrote that memory-hog script a few times to break down the variables into smaller units and once it got below a certain threshold Java was fine again. So you definitely have a memory cap there somewhere you need to be aware of. Of course you should be aware of memory use on any platform but I would be remiss not to point out that old man Perl kicked all the youngsters.
There are enormous sites running on any of these technologies: Google uses Java and Python, Yahoo is using PHP, MSN uses ASP.NET, Slashdot uses Perl, ...and yet there are no end of fan boys willing to tell you technology X is the *only* one that can handle a serious situation. Go figure.




Conclusion from this: You don't know how to write java. Java does string processing just fast as perl, the only difference is doing it in java is a pain and its built into perl.I had another test (somewhat ridiculous) that processed enormous strings of several megabytes. Grandpa Perl tore through it like nothing even when entire 5MB+ strings were passed as single variables. PHP definitely lugged a bit. Java crashed.


That is indeed one valid conclusion. The other is that perl is less memory intensive.Originally Posted by Snaily




Java's VM takes up a bit more memory than Perls interpreter but the difference is in terms of kilobypes...not megabytes and therefore trivial. The problem was your code its really that simple. Java does not crash when processing 5MB+ of text.The other is that perl is less memory intensive.
"Grandpa" Perl isn't faster than Java...doesn't use less memory....its not even in the same class as Java.




Well, I think this is indesputable then...Originally Posted by Snaily


But it did crash. I have no doubt that you could build a competent Java program to blaze through that text in record time. In fact with a little rewriting even I the non-Java guy was able to get it going reasonably well. The point is the same inefficient code was passed to both environments and Perl tore through it while Java hung. The Perl code was certainly not optimized. This was not a comparison of best practices, it was a memory intensive test. I appreciate that Java is a more complete programming language than Perl, PHP or Python but scripting languages have their strengths too. In this case Perl handled sloppy, memory intensive string handling better than Java.Originally Posted by Snaily




Right...so the problem was your code.But it did crash. I have no doubt that you could build a competent Java program to blaze through that text in record time. In fact with a little rewriting even I the non-Java guy was able to get it going reasonably well
No the "same" code was not passed to both environments...and that is just the problem. When you do benchmarks you must compare similar implementations...you can't do that if you don't know the two languages well. The last time I checked Perl and Java have very similar speeds as far as string processing goes. Although this isn't saying that much though as string processing for Java is a weakness.The point is the same inefficient code was passed to both environments and Perl tore through it while Java hung. The Perl code was certainly not optimized.
So then your only point is that it is easier to write string processing code in Perl (that doesn't suck)? Given the language was made for that....this is hardly suprising.In this case Perl handled sloppy, memory intensive string handling better than Java.
They do... But the people that use them should not get upset at the idea that other languages like Java and .NET are faster.Perl, PHP or Python but scripting languages have their strengths too





http://shootout.alioth.debian.org/gp...php&lang2=java
Java does use more than PHP memory for most of the tested programs. Except for the regex test and reverse complement, java absolutely kills PHP. Looks like PHPs regex implementation is fairly good, though.
I'll concede that virtually all of these tests are either very calculation intensive and/or very IO intensive. This may not automatically translate into faster web apps, but it certainly doesn't hurt Java to be faster at number and IO crunching.
OpCode caching would not cause PHP to fare better in these tests, as it's a single run. OpCode caching merely mitigates the performance impact from having to parse/compile to opcode on each request.
/mouse




The regex engine in PHP is done in C...so this would explain why its able to match Java in speed (and even do a bit better).Looks like PHPs regex implementation is fairly good, though.





In the grand scheme of a web request, the time spent at the server is but a fraction of the whole.
It's like arguing about whether the Porsche or the Mercedes is faster, even though both are limited by the speed limit on the highway.
Originally Posted by Viflux
I once had the chance to drive both of them. I had already driven a Mercedes before so I knew how to handle that car. I went really fast with it. The Porsche however was kind of unfamiliar to me, and it didn't took me long to crash into the next wall that came up...
![]()
Bookmarks