View Single Post
Old 05-13-2022, 04:36 PM  
dcortez
DINO CORTEZ™
 
dcortez's Avatar
 
Industry Role:
Join Date: Jun 2003
Location: Vancouver Island
Posts: 2,145
Quote:
Originally Posted by wankawonk View Post
One thing to remember is that a python (or nodejs) server-side app is spending 99% of its compute time on external software implemented in C

Python is just a little bridge between the web server (nginx, apache) and the database, which are both (probably/usually) written in C (nginx is C).

All python is doing, is parsing some parameters out of the request, using those params to compose and execute some database calls, and then rendering the database response into an HTML template (which is then passed back to nginx)

So it really doesnt matter, *at all*, that python is slow and bloated as hell. 99% of the work is done in external software implemented in C.

Incidentally, even within python, a lot of the libraries are implemented in C. Scientific computing in python (numpy) runs at C speeds because the actual library is implemented in C and loaded directly into the python runtime (which is also implemented in C).

Python (and any modern framework) really just stitches together a whole lot of C code.

I hate ruby/rails and yes, its slow and bloated just like python, but again, 99% of compute time in a rails app is spent outside the ruby runtime.

Now I'm just rambling -- but python can easily look like a joke to a Java developer because of the global interpreter lock. It literally doesn't support threads at the OS level. That seems insane until you realize that in a python server app, nginx is acting as a proxy in front of many python processes. It doesn't matter that each process is limited to a single OS thread -- we're simply using a completely different paradigm than a Java developer is used to.
I've just been comparing Python to PHP to Perl.

Perl can outperform Python, and the main "complaint" about it is "readability". That's no problem for me. I wrote a dynamic MYSQL web content management system in Perl with 20 million web pages - database driven, but automatically cached as HTML in non-peak hours.

It handled 6 million visitors over a couple years.

That was fun and it worked on a basic VPS without overloading the server. The trick was to NOT use the database in real time.

For the server side, I can go with PHP or Perl. I like Perl because I can run it from my desktop without a server for dev purposes.

At this point, I'm very interested in exploring Java programming for desktop software and apps. Back in mid-nineties I did some "hello world" level Java tutorials. It's a lot like object oriented C.

Thanks very much for your comments. Now it's time to get my hands dirty...

dcortez is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote