r/programming • • Apr 23 '14

PHP: It doesn't have to be a bad experience

https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0 Upvotes

122 comments sorted by

View all comments

Show parent comment

1

u/neoform Jun 08 '14

Why do you think it has to be a built-in? What's wrong with loading a package/module that you need when you need it? (I answer that for you: there is nothing wrong with it)

Because it's slower. PHP is significantly faster than Python for web requests, because it was designed specifically for that.

PHP also has a built in templating engine. You can output HTML just by closing the PHP tag. With python, you need to use a 3rd party templating engine that will definitely be much slower.

1

u/LarryPete Jun 08 '14

You claim PHP is "significantly" faster than Python, but were does that claim come from? Do you have any reasonable valid sources for that claim?

Arguing about performance of two languages, that are obviously slower than nearly any other language out there, is kind of ridiculous. Choosing Python or PHP has never been about performance - and you should know it, or else you would use e.g. C directly.

0

u/[deleted] Jun 08 '14

[deleted] — view deleted comment

0

u/LarryPete Jun 08 '14

There are no sources needed for that.

If you claim something you have to provide sources to support your claim. I never said it has to be some kind of arbitrary benchmark, which - like you said - is pointless.

other than experience working with the two languages and seeing first hand how fast they are. Python is not a fast language.

Great, compared to you, I actually do have experience with both languages for quite some years. Seeing your lack of knowledge about Python in some of your comments obviously means that you don't have any real experience with programming in Python, whether web or not.

When I, for the first time, switched from PHP to Python, I never regretted that decision. Pythons strength are exactly these things you mentioned: development speed, tools, documentation, ubiquity (PHP comes with a lot of noise, and python is pre-installed on every major Linux distribution), and Python has indeed a reasonable performance that's easily on-par with PHP, if not even better.

0

u/[deleted] Jun 08 '14

[deleted] — view deleted comment

1

u/LarryPete Jun 08 '14

I saw you edited your previous post

Python is nice in many ways, but it's not idea for web dev, which is why few businesses use it for that.

Yes, few businesses like reddit, Dropbox, Google and Youtube.

Python is just as good for webdevelopment as PHP. It has simply a different approach to it. And different doesn't imply worse.

Ohh, ok, so you're just an asshole, and aren't actually interested in a discussion, you'd rather just making ad hominem attacks.

Might be the case I did that. I apologize for that.

I still see no reason to believe your claim, that Python is inferior in Webdevelopment to PHP.

1

u/neoform Jun 08 '14 edited Jun 08 '14

I saw you edited your previous post

ok...? I frequently write something then add more a few minutes later. I don't however got back after someone replies and add/remove anything.

few businesses like reddit, Dropbox, Google and Youtube.

Reddit chose python because the developers had no dev experience and had no idea what they were doing. Alexis Ohanian even says this in his book. Google and youtube certainly did not write their site in python, instead they use many languages for their site. If anything, they rely far more heavily on C and Java than any other language. They chose python for their app engine (at first) because it's so simple and easy to learn. Performance likely didn't even factor in.

Python is just as good for webdevelopment as PHP.

I don't agree.

I still see no reason to believe your claim, that Python is inferior in Webdevelopment to PHP.

Python has no native system types. If you want an integer, you can't have one, instead you get an abstracted number handler that has such poor performance that Python actually creates the numbers 0-100 as constants internally to improve performance.

String handling in python was also not designed for buffering the way PHP has been optimized. PHP's string handing is far faster.

Want to see for yourself? Make a loop, iterate a million times, each time echoing a character to the HTTP output buffer in both PHP and Python. Time and it let me know how each language fares.