Converting php codes into highly optimized c++ codes reduces the overheads in all sections of server side, how this hiphop procedure is doing? how a php function can be transfers to a c++ code ?
Printable View
Converting php codes into highly optimized c++ codes reduces the overheads in all sections of server side, how this hiphop procedure is doing? how a php function can be transfers to a c++ code ?
In general, yes. c/c++ is faster than php. How much of a benefit you see will depend on how well your particular php code can be converted (for example, if 95% of your script execution time is spent waiting - for example, for responses from a database - then you won't see much difference anyway).
hiphop reads your php source, and writes c code that does the same thing. After all, php is written in c in the first place.
Thanks..
It reads from your statement there is no need to convert php code into an optimized c++ code ? In my POV normally people don't want to do this, but for a website having high traffic will reduce the usage of server resources 90% if it convert php into c++
Any special libraries must uploaded to run c++ in Linux server support php hosting ?
In many cases, it would not lead to the improved performance you might expect - especially for the average user. Yes, the PHP code itself will run faster, but code execution is almost never the performance bottleneck (unless you have serious problems in your code, for example, memory leaks, deep nested loops, etc.—in which case, those problems will likely still exist once converted to c). In most cases, slow code is the result of external calls, disk i/o, and similar things. Typical website php scripts will see a much bigger performance gain by taking all of their database queries out of loops than by adopting hiphop.
As I said, this may or may not be the case for any given website.
Edit: Actually, it would appear to _not_ be the case. Hiphop claims an average 5x improvement …over php 5.2. But php 5.4 (I couldn't find numbers on 5.5) is nearly twice as fast as 5.2 anyway.
Facebook, for example, got good use from this because the rest of their software base was already so well-developed that php execution time actually was the bottleneck (plus, with such a large, high-use application, they needed all they could get).
To be plain, even if php execution times were decreased by a factor of 5, the vast majority of php websites would never even notice. "High traffic" -in Facebook context- is nearly incomprehensible for any other website.
Obviously, your host would have to support hiphop. I would not expect that many do.
The alternative would be to get a private server, and install it yourself.
Thanks,
NOW PHP is best language which is more flexible than any other languages for web development , because the majority of website seeing online are developed in php, there is no debate over that.
Linkedin is another big traffic website, i think developed with java only, says better scalable language ?
From reading above statement i came to a conclusion that chances came for using hiphop is because of the ancient depreciated coding formats, it is not replaced with latest php codings but instead using c++ for that.. it is true ?
Popularity is not a measure of quality.
PHP is very popular, but this has more to do with its low entry barrier (new/amateur programmers can accomplish basic things very quickly) and tolerance of errors, poor coding design, etc..
Likewise, php can be used for many tasks, but I wouldn't call it particularly "flexible" in comparison to other languages. I can do just about anything with php, but some things aren't convenient at all.
Once you get into how PHP actually works, and the quirks and oddities that it has, it quickly becomes obvious that it is actually quite haphazard and has problems from the lowest levels. The last two versions have done wonders for performance, but there is still a lot to be desired, and some of it seems to be unfixable.
Likewise, java is very popular, but that doesn't automatically make it good.
I am not sure what you mean by that. What I was pointing out is that code optimization has more to do with the design/"plan" of the code itself, and less to do with which language it's written in.
Not saying things about popularity, all languages have its own benefits and its own disadvantages, every thing is human made, what ever things which is introduced by a human is not 100% reliable, In php inexperienced programmers can do small things, experienced programmers can do big things, all languages are equally qualified. But my question is why a need arise that a complied language like c++ is using with php, but not arising a need with java? But this question set to active only for websites having big traffic(just 1 or 2 websites).
Poor coding and design ? Absolutely wrong, if any of the programmers is saying any of the languages have "Poor coding and design"(not in ur case) they are only making a debate that the the language they are using are best , I would like to refer it as Senseless, Meaningless, Unworthy and Disqualified,
Poor coding will leads to a lot of security issues, and will not bring correct output, is it happening in the case of php ?
Security of an applications are mainly depend on the logic we are applying, not with what type of language we are using, we can add as much off security modules to our application which depends on view of a security analyst. In POV if anybody saying " using this language will provide added security", that is an advertising technique or that person have only knowledge about the language he is working nothing beyond that
All languages have its own advantages and disadvantages, because all are developed by humans and all are best suited for humans, but i give priority for web development as PHP, JAVA, .NET, PYTHON, RUBY
[/QUOTE]
Yes according to above statement code optimization will reduce the overheads ? due to overhead and to reduce overheads php is converting to optimized c++ codes, then cause of overheads is due to lack of code optimization means poor coding,
Finally if we build a fine programming architecture in php there is no need to convert it into other languages ?
Java is a compiled language.
By "poor coding design," I was referring to scripts that may not be written as well as they could be; not to the PHP language itself.
In the case of badly written programs, yes. Again, I wasn't talking about the language itself (though php has had its share of security vulnerabilities).
IIUC, yes and no. "Optimization" can apply to many different aspects of a program. Converting to c will certainly remove the overhead of interpreting your php to bytecode on each request, but you can achieve that by using APC/similar. However, it won't magically fix an inefficiently written script, and it won't affect things like disc i/o time or network communications (e.g., querying an external database) at all.
Here's what I was getting at. Most of the time spent running your script is not spend running the script itself, but on other things. Hypothetical example:
Say hiphop removes the time spent interpreting your script, and makes execution five (or even ten) times faster. What about all the other stuff? And this is not an exaggeration; putting stuff on the HD easily takes hundreds of times longer than the parts of your program that execute in memory; network activity is hundreds of times slower again.Code:---| apache
-----| php interpreter
---| php execution
-----------------------------| disc i/o (e.g., writing a file)
--| php execution
----------------------------------------------------------| do some image manipulation
--------------------------------------------------------------------------------------------------------------------| query DB and wait for reply
---| php execution
-------------------------------------------------------------------------------------------------------------------------------------------------| send response to user
For most people, probably not. The requirements would usually outweigh the benefits. In high-use cases, where every small performance increase counts, then yes. If you've already made every other practical optimization, then yes. And either way, if you want to, then why not?