3 ms·
For all the daily articles that pop up here on HN concerning premature optimization I find it surprising to see this thread and all the sentiment of language ch
by hokumguru 7y ago
For all the daily articles that pop up here on HN concerning premature optimization I find it surprising to see this thread and all the sentiment of language choice mattering.
It’s far easier to work in and translate thoughts to more feature rich languages. The vast majority of the time it’s not the language itself that will be an optimization issue down the line but rather the written code.
- overgard 7y agoHere's the problem, your language isn't the optimization issue... until it is. You optimize all the hot-spots on your profile, and then... all the sudden you're looking at a very big samey chart of everything taking slightly-too-long even though you've optimized every possible thing and there's nothing that particularly sticks and and there's nothing you can do about it. And then you're totally fucked, because you're looking at a rewrite at that point; probably in a language your team doesn't know and doesn't like. Sometimes language matters! Not always, but frequently!
- saagarjha 7y ago> you're looking at a rewrite at that point; probably in a language your team doesn't know and doesn't like Or you commit atrocities like rip the garbage collector out of Python. I’m not joking; Instagram did this: https://instagram-engineering.com/dismissing-python-garbage-collection-at-instagram-4dca40b29172 https://instagram-engineering.com/dismissing-python-garbage-...
- overgard 7y agoHeh! That is fantastic!
- lasagnaphil 7y agoThat’s actually a pretty clever (and crazy) idea, because when you disable the gc in Python the reference counting still works and only the cycle detection part is vanished. So you are just dealing with reference semantics the same as C++’s shared_ptr or Swift’s references, which isn’t that hard to use if you are careful about cyclic refs. And if the memory leak exceeds a certain amount they can just restart the process.
- tyingq 7y agoThat's also how Perl functions. No generational GC, just ref counting. So you're fine if you don't make circular references.
- Doxin 7y agoDisabling the python GC like that isn't that crazy. They didn't add gc.disable() because you shouldn't use it. The crazy part is some library calling the gc directly without a way to disable it. That's just bad form. A lot of games in gc-ed languages turn the gc off, and then manually run the gc whenever there's some spare time in a frame. The same thing should more or less work for a server handling web requests too. Maybe run it after every request or perhaps every couple of requests depending on memory usage.