Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Converting PHP codes into highly optimized c++ codes

  1. #1
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default Converting PHP codes into highly optimized c++ codes

    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 ?
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by letom View Post
    Converting php codes into highly optimized c++ codes reduces the overheads in all sections of server side …
    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).

    Quote Originally Posted by letom View Post
    how this hiphop procedure is doing? how a php function can be transfers to a c++ code ?
    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.

  3. #3
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by traq View Post
    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 ?
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by letom View Post
    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…
    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.

    Quote Originally Posted by letom View Post
    …a website having high traffic will reduce the usage of server resources 90% if it convert php into c++
    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.

    Quote Originally Posted by letom View Post
    Any special libraries must uploaded to run c++ in Linux server support php hosting ?
    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.
    Last edited by traq; 11-29-2013 at 08:11 PM.

  5. #5
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default

    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 ?

    Quote Originally Posted by traq View Post
    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.
    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 ?
    Last edited by letom; 11-30-2013 at 07:19 AM.
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by letom View Post
    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.
    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.

    Quote Originally Posted by letom View Post
    Linkedin is another big traffic website, i think developed with java only, says better scalable language ?
    Likewise, java is very popular, but that doesn't automatically make it good.

    Quote Originally Posted by letom View Post
    Quote Originally Posted by traq
    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.
    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 ?
    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.

  7. #7
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by traq View Post
    Popularity is not a measure of quality.
    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).

    Quote Originally Posted by traq View Post
    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..
    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


    Quote Originally Posted by traq View Post
    Likewise, java is very popular, but that doesn't automatically make it good.
    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]


    Quote Originally Posted by traq View Post
    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.
    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 ?
    Last edited by letom; 12-01-2013 at 05:09 AM.
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

  8. #8
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by letom View Post
    …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?
    Java is a compiled language.

    Quote Originally Posted by letom View Post
    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,
    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.

    Quote Originally Posted by letom View Post
    Poor coding will leads to a lot of security issues, and will not bring correct output, is it happening in the case of php ?
    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).

    Quote Originally Posted by letom View Post
    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
    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:
    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
    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.

    Quote Originally Posted by letom View Post
    Finally if we build a fine programming architecture in php there is no need to convert it into other languages ?
    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?
    Last edited by traq; 12-01-2013 at 10:34 PM.

  9. #9
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by traq View Post
    And either way, if you want to, then why not?
    I will try my best not to copy the idea and architecture of others, instead of that finding an advanced one for freely distribution, but if not possible do it as same..
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

  10. #10
    Join Date
    Jul 2012
    Posts
    198
    Thanks
    54
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by traq View Post
    Java is a compiled language.
    Java is running through JVM(Java Virtual machine), says neither compiled nor interpreted..
    You will know the truth, and the truth will set you free (John 8:32)(The truth is about the only begotten son of GOD.....When you feel you are alone for facing your problems, God will never leave you by your own You are important for God

Similar Threads

  1. Replies: 1
    Last Post: 05-10-2010, 03:18 PM
  2. help with the codes!
    By makarov in forum Java
    Replies: 1
    Last Post: 11-15-2009, 09:36 PM
  3. BB codes
    By vaibhav24in in forum PHP
    Replies: 5
    Last Post: 03-13-2007, 07:27 AM
  4. Need help with these codes please!
    By Quanlin127 in forum HTML
    Replies: 5
    Last Post: 01-25-2006, 07:12 AM
  5. Codes
    By Charmed in forum HTML
    Replies: 2
    Last Post: 05-25-2005, 11:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •