Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In that time the java app parsed 50 strings for object hierarchies (using a regex that isn't cached) and extracted values from a request object to a processing object, handled errors, and logged results.

3 times.

This is the naive version of that code, because "I will parallelize it later" and I was just getting the logic down.

Turns out, when you use programming languages that are fit for purpose, you don't have to obsess over every function call, because computers are fast.

I think people vastly underestimate how slow python is.

We are rebuilding an internal service in Java, going from python, and our half assed first attempts are over ten times faster, no engineering required, exactly because python takes forever just to call a function. The python version was dead, and would never get any faster without radical rebuilds and massive changes anyway.

It takes python 19ns to add two integers. Your CPU does it in about 0.3 ns..... in 2004.

That those ints take 28 bytes each to hold in memory is probably why the new Java version of the service takes 1/10th the memory as well.



22ns might be about 100 processor instructions. Somehow I doubt that any programming language can parse 50 strings in 100 instructions, let alone with naive code.


You are right.

I have said something very wrong. Java may be fast but it isn't magic.

What I claimed is not possible and I should have realized that.

I can not correct my previous claim. I wish HN had longer edit windows and I wish HN allowed you to downvote older comments.

I cannot erase this wrong info


Python is slow but in my experience (that mostly relates to web services and data processing) I found that I/O was by far the biggest bottleneck. Waiting for the database, another http service or local storage, which often takes more than 1ms anyway.


Yep.

Except when it’s not I/O.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: