4 ms·
It is funny how people want to believe in tools. In fact, the optimizations compiler does are incomparable with those programmer could do by choosing an appropr
by dschiptsov 14y ago
It is funny how people want to believe in tools. In fact, the optimizations compiler does are incomparable with those programmer could do by choosing an appropriate data-structure with corresponding algorithms and by being aware of strengths and weakness of a particular CPU architecture.
JVM, which is nothing but a stack-based byte-code interpreter is the most famous case.) People seems to believe it can do wonders, especially in memory management and data throughput.
It is so strange to see how people are trying to create a whole world inside a JVM. What it is called when people are building models of ships inside a bottle?)
btw, now, it seems, they are trying to build a whole world inside a V8 bottle.)
- lmm 14y agoMy experience in the industry is just the opposite; people will do anything to avoid admitting that the tools can do better than they than. I've had senior programmers sneeringly declare that anyone who uses a debugger must be an inferior programmer, and then watched them spend a full day figuring out a bug that could be found in half an hour with the appropriate tool. You know why it's worth recreating the world inside a JVM? Because its behaviour is so much more thoroughly specified and predictable. Prior to Java, C++ didn't even have a memory model; every new release of GCC breaks a whole raft of C programs that didn't realise they were invoking undefined behaviour by having integer overflow. By the C standard, even a single instance of undefined behaviour invalidates your whole program, making it virtually impossible to predict the behaviour of any nontrivial-sized codebase.
- dschiptsov 14y agoIn my opinion it is a computer architecture that has a memory model, not Java or C++. For some strange reasons nginx - a mere C program - works for millions. So does postgresql or redis or whatever.
- tonyarkles 14y agoI half agree. C++ directly exposes the underlying computer architecture's memory model. Java abstracts it reasonably well and essentially results in a different model with different advantages and disadvantages (e.g. garbage collection and garbage collection :))
- colanderman 14y agoIn my opinion it is a computer architecture that has a memory model, not Java or C++. Unfortunately that opinion is by definition incompatible with portable computer languages.
- dschiptsov 14y agoWhat is wrong with Schemes or Lisps?) Well, even Python (cpython) is more portable than Java. All it needs is working C compiler. It is ported to Plan9 and Android.)
- lmm 14y agoPython has a memory model. It's just too bad that so much of the python ecosystem relies on bindings to C libraries, so you go to resize an image and then you get a segfault that brings down your whole program (real example).
- colanderman 14y agoSchemes and Lisps have memory model, it's just one that's radically different enough from processor memory models that no-one realizes it's a memory model and thus no-one gripes about it being different from processor X's memory model. If you're wondering what the memory model is, you should ask yourself: What happens when I mutate a cell? are those changes visible in references to that cell? are those changes visible across thread boundaries? What happens when I dereference a cell? Does it continue to take up memory or is it garbage-collected? What if it's part of a cycle? But I digress; your point was actually about languages that don't talk about memory, such as the lambda calculus. A degenerate memory model is still a memory model, and an inherently portable one at that. My point is, for languages which do talk about memory, it's necessary that they specify how that memory works in order to be a portable language.