Hacker News new | ask | show | jobs
by fmhul 2609 days ago
You'll always need more performance so you'll end up rewriting big parts of the codebase in C because you can't afford the servers and/or can't scale anymore. You'll be kicking the can down the road again and again. Also C is hard. At that point you will realise using Python was a stupid idea when you had other options like Go. It has happened to many people.
2 comments

You'll always need to integrate libraries already written in C and other languages not under your control. So why use a language that goes out of its way to make that difficult?

That's why Sun's "100% Pure Java TM" campaign and negligent support of integrating Java with native code was so misguided.

Software development is a process. You implement your MVP in one language, then measure its performance with real customers, then incrementally rewrite the hotspots and plug in optimized native libraries as necessary. The language ecosystem and culture should support and encourage that (like C#, Python, TCL and Lua do in spades), not fight against it and condemn you as a mongrel infidel if you dare to miscegenate with other languages.

Sun made a grave mistake with their linguistic supremacist "100% Pure Java TM" propaganda campaign: you should rewrite all of your code in Java instead of expecting Sun to provide you with easy seamless interoperability with existing languages and libraries.

So Sun's JNI and applet web browser integration languished while Microsoft integrated COM and CLR and P/Invoke for seamless interoperability with the web browser and other languages like C++ into Java and CLR. And the insipid influence of "100% Pure Java TM" persists even today (have fun using Android NDK).

Sun also had an unholy obsession with code generation, since their attitude was to breed as much "100% Pure Java TM" Code into the world as possible (see AspectJ, JAXB, etc). While C# took a much better approach of supporting code annotation and metadata and reflection and bytecode generation at runtime so you didn't actually have to generate and compile a huge pile of boilerplate source code (see P/Invoke).

https://docs.microsoft.com/en-us/cpp/dotnet/how-to-call-nati...

http://www.pinvoke.net/

And of course Oracle is delighted to continue pushing "100% Pure Java TM":

https://www.oracle.com/technetwork/java/100percentpurejavaco...

>[...] 100% Pure Java, JavaStar, JavaPureCheck, [...] JavaSpin, HotJava, The Network Is The Computer, and JavaStation are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries.

Registering purity as your trademark and insisting that all of your users rewrite every bit of their existing legacy code in your pure language, and never use or talk to any other languages ever again, always seemed like separatist linguistic supremacy to me.

Apparently, C#'s P/Invoke is an evil impure cross-language conspiracy to dilute our linguistic purity and sap our precious bodily fluids, breeding caravans of mongrel coders who will swarm across our open borders and steal our jobs. That's why JNI and NDK are only used by unpatriotic second class citizens with divided loyalties, so they don't deserve to be well supported or maintained.

https://www.zdnet.com/article/100-pure-java-initiative-wins-...

>"Keep Java pure" is the message behind Sun Microsystems' 100% Pure Java initiative which has already won support from 100 developers but will lock out programs such as Visual J++. The move is an attempt on behalf of the Californian firm to maintain integrity of Java code and build awareness.

https://www.cnet.com/news/100-pure-java-watered-down/

>Viewers of cable news network MSNBC may recently have seen a commercial for Sun Microsystems (SUNW) in which a man tells a priest that he's been thinking "pure" thoughts. When the beatific man exits the confessional, he passes a queue of anxious programmers--one wearing a Visual Basic shirt--ready to admit their sins.

>The commercial, which touts Sun's "100 percent pure Java" campaign, is not your usual television ad. But Sun has in many ways shown an almost religious determination to spread the gospel of Java to the far reaches of the globe, even sponsoring a worldwide educational tour for programmers with the support of Netscape Communications, IBM, and Novell.

I don't think I've ever seen a commercial Python codebase that actually did rewrite things in C for speed.

Much more likely is using a library like NumPy where someone else has done that C performance work for you.

Plus in 2019, it's much cheaper to design for horizontal scale and spin up a few more instances.

I have personally rewitten a number of expensive inner loops into C to make Python be less slow. It is easy (if you find it hard Go wont be an option for you). I would say the argument against Python is not raw speed but concurrency model. I use gevent for io bouns studf but going multi CPU with data sharing is hard for the engineer and slow for the code compared to Go and goroutines. Subprocesses are ok and sending data over sockets is ok but serialization several times is sucky. Worse than extra memcpy. Also one big msg can block your interpreter.