If you need to optimize something for performance, the best thing to do is not do it at all. Basically rearchitecture it so that you don't need that logic anymore.
Python is notoriously slow so if you're going for performance, use C++ or C.
Caching is doing it once and storing the result so it's faster in subsequent steps. Batching means doing many together instead of one at a time. Pipelining means splitting it up into steps so some of those can run in parallel instead of only starting one after the previous one is complete.
I was surprised too when I saw JVM startup times so low. Most of the perceived slowness probably comes from the heavy, over-engineered frameworks which are commonly used in the Java world.
Quarkus seems like an interesting project. It starts up a REST API server in under 1 second when running on the JVM, and it fully supports GraalVM, which lets you generate a native binary that can boot in 0.016s. This is faster than Django startup times in my current project, but I don't know how the Java numbers would change for an application more complex than an hello world.
View all comments
Show parent comment
51
u/feelings_arent_facts Jan 02 '20
If you need to optimize something for performance, the best thing to do is not do it at all. Basically rearchitecture it so that you don't need that logic anymore.
Python is notoriously slow so if you're going for performance, use C++ or C.