This code is mostly just testing the regex engine?
How come PHP seems so much faster than Rust?
41–50 of 116 posts
Re: How come PHP seems so much faster than Rust?
#42Earlier quoted context omitted.
I don't like it from the security perspective, looking at just how many vulnerabilities PHP-based software has had, it's too trivial to create a XSS, SQLi, CSRF, LFI, RCE and many other classes of vulnerabilities. I think there are better options out there than on average give better results. Maybe it's just incredible selection bias I'm encountering \ shrug .
But plenty of those vulnerabilities are not the fault of the language but the frameworks written by others. You can just as easily create SQL injection attacks in a Rust program or Ruby program. You can just as easily introduce XSS/CSRF problems in any of them. Etc.
Re: How come PHP seems so much faster than Rust?
#43Earlier quoted context omitted.
Not a monopoly, but it was the easiest and most performant option at lower price points. Java required specialised or dedicated hosting ($$$). CGI was slow as hell. Mod_perl often was not available in shared hosting, for whatever reason. PHP was cheap, fast, ubiquitous, and Good Enough ™, for about a decade. Then VPS happened and the market changed.
Most people initially deployed php via CGI in my experience. I don't remember when mod_php arrived, but we'd been using PHP for quite some time at that point. While CGI was slow-ish, alternatives like fastcgi were already around (and in fact running PHP via fastcgi was also quite common for a while. By the time PHP became ubiquitous, most people had moved away from plain CGI regardless of language.
Mind clarifying how this is different from the current hotness (from what I can tell, due to a decade-old shortcoming that no longer exists in mod_php/Apache MPM options) where folks are running PHP via the Fastcgi Process Manager?
Re: How come PHP seems so much faster than Rust?
#44Earlier quoted context omitted.
I don't like it from the security perspective, looking at just how many vulnerabilities PHP-based software has had, it's too trivial to create a XSS, SQLi, CSRF, LFI, RCE and many other classes of vulnerabilities. I think there are better options out there than on average give better results. Maybe it's just incredible selection bias I'm encountering \ shrug .
Your argument is a form of survivorship bias. You're not acknowledging all of the gaping security flaws in contemporary web-development frameworks. People were writing sloppy PHP before CSRF and XSS were even invented. Yet somehow, Python, Ruby and NodeJS have all had numerous CVEs despite those attack vectors being well known at the time a given framework was written. You think SQLi was bad? You should spend some ti…
It is very very easy to write sloppy PHP, definitely easier than in many other languages and default frameworks.
> You're not acknowledging all of the gaping security flaws in contemporary web-development frameworks. P
I'm very aware of them, basically none have (had) as many high-impact vulns as PHP-based stuff does.
> Yet somehow, Python, Ruby and NodeJS have all had numerous CVEs despite those attack vectors being well known at the time a given framework was written.
You're not acknowledging the orders of magnitudes difference between the impact of an usual PHP vuln and those you listed.
> You think SQLi was bad? You should spend some time thinking about the numerous attack vectors available today in nearly every GraphQL implementation
The flaws in others are a very poor excuse for flaws in a thing itself.
Re: How come PHP seems so much faster than Rust?
#45Earlier quoted context omitted.
PHP isn't popular because it's easy, it's popular because for a long while it was the only viable language for developing web applications.
Not sure I agree with this. Here's why: new tech stacks crop up every few months, and they're all competing for the same developer brain space. If PHP wasn't easy, I'm certain the interest in it would have evaporated to a large extent. Yet even today, people are choosing to start their projects in PHP. I think it's simplicity has a lot to do with it.
To this day, cloud functions still deal with "cold starts", where this was already a solved problem with PHP shared hosting.
All PHP needed to be was good enough. It was how it served pages that made it as popular as it was.
Large disclaimer, I know a PHP shared host was not actually scalable like AWS Lambda. Just the idea that any small business could plop down a few servers and start selling shared PHP hosting was huge back then.
Re: How come PHP seems so much faster than Rust?
#46Earlier quoted context omitted.
Indeed. I think most developers don't understand how amazing PHP was compared to the competition and just how fast it acquired new features during those early years. It was a scripting engine with a such a thin layer of C that it could easily and quickly incorporate the huge number of open source C libraries that existed at the time.
While your observation is true to some degree, I do remember ASP, Cold fusion, CGI and a few other more obscure technologies way back when. Perhaps I was quite late to the party though - I only started programming in 1999 (got a computer for my 11th birthday!) - so I'm not sure what it was like before then.
CGI just would run any type of script. Originally that was typically Perl but PHP surpassed Perl for a variety of reasons. PHP could be run either through CGI or through mod_php in Apache. There was also a mod_perl I believe and a few others but php is what web hosts typically installed in the early 2000s.
Re: How come PHP seems so much faster than Rust?
#47Earlier quoted context omitted.
Indeed. I think most developers don't understand how amazing PHP was compared to the competition and just how fast it acquired new features during those early years. It was a scripting engine with a such a thin layer of C that it could easily and quickly incorporate the huge number of open source C libraries that existed at the time.
While your observation is true to some degree, I do remember ASP, Cold fusion, CGI and a few other more obscure technologies way back when. Perhaps I was quite late to the party though - I only started programming in 1999 (got a computer for my 11th birthday!) - so I'm not sure what it was like before then.
This is the competition that PHP was so much better than.
Re: How come PHP seems so much faster than Rust?
#48Re: How come PHP seems so much faster than Rust?
#49Earlier quoted context omitted.
The reason for picking it is for memory safety as well as performance. If your problem involves a lot of regex and memory safety isn't as critical, then feel free to pick a language with good regular expression libraries. If regular expressions are a smaller part of your problem you're solving, looking at overall performance is better than benchmarks like this.
I'd never know that if this post didn't exist, so I don't think the investigation is silly at all.
Re: How come PHP seems so much faster than Rust?
#50Earlier quoted context omitted.
This is more than a little silly, and simply shows that the self-proclaimed PHP developer (who is "not surprised that PHP is 'fast'") has little to no idea what is costly in execution time, even in such a tiny example of a program, and has no idea how to figure that out.
What's silly is that somebody asked a legitimate question in good faith with code samples and everything, and you responded with an ad-hominem attack with no useful information.
But we can't all be geniuses. I'm not one, either, but I don't feel attacked by anyone for pointing that out, and you shouldn't, either.