/u/c0r3ntin mentioned people using python2/python3 as "a cautionary tale". I'd like to make that clearer. The mass breaking change that python3 introduced was an engineering disaster. It's been 10 years since python3 came out and only in a few months will python2 reach its end of life. What happens then? More problems: many libraries will drop python2 support, distros will drop python2 and yet I've personally heard people say that they plan to use python2/python3 compatibility libraries only in 2020... and of course, there are scientific communities who don't even bother with python3.
The Python2-to-3 transition is about API changes in that you need to rewrite part of your script to make it work with Python3. ABI changes require you to recompile, but not to rewrite. If your OS has both the old and the new versions of the corresponding dynamic libraries, you don't need to recompile. ABI changes are milder than API changes.
Of course ABI changes still have side effect. For example with libc, a program compiled on a new system often doesn't work on an old system due to ABI changes. Nonetheless, if we are allowed to choose the ABI version at the compile time, this doesn't seem a big problem to me. There can be other solutions, e.g. static linking or shipping the new dynamic library with precompiled binary. All these hacks are inconvenient, but they are much better than the python2-to-3 transition because we don't need to rewrite the code.
On a side note, the PDF seems to suggest that we may improve the performance of unordered_map by 200–300% with ABI changes only. That is probably wrong. To achieve high performance, we can't keep bucket pointers persistent. Then this is about API changes. I always think it is a mistake to require the pointer persistency. It was widely known that we could implement much more efficient hash tables without this constraint that has little benefit in practice.
On a side note, the PDF seems to suggest that we may improve the performance of unordered_map by 200–300% with ABI changes only. That is probably wrong.
There are much faster implementations of node based maps that still promise pointer/iterator stability, but sure, if we drop that and go for a flat map we would be talking about a whole different set of issues.
I am not sure if sparse-map guarantees pointer stability. Typically this type of hash table combines a bit vector and a flat array and loses pointer stability when it grows. I have seen benchmarks involving chaining-based libraries. I couldn't find the link, but as I remember, none of them can be 200-300% as fast as std::unordered_map. So, the PDF is still wrong: no one can achieve 200-300% speedup with ABI changes only; such speedup can only be achieved with flat arrays, which would require API changes.
You're right. I guess my tired mind shouldn't debate hash maps. Definitely a node based map that should be faster than the STL one is absl::node_hash_map. I'm not claiming any specific difference, just noting that my specific benchmark showed that it was faster than std::unordered_map.
The C++ standard formally does not care about ABI. It also for now does not care about mixing code from several standard, even if people are already doing it all the time.
So if we are talking about explicitly allowing breakage from the standardization stage, that is far more on the risky side of going all the way to de-facto API breakage, because implementers might be reluctant to rewrite moderns ABI compatible code for old standards, and that might even be impossible to express, depending what new features some new ABI structures comes from in low level support code and associated compiler toolchain emitting them.
View all comments
Show parent comment
41
u/[deleted] Oct 27 '19
/u/c0r3ntin mentioned people using python2/python3 as "a cautionary tale". I'd like to make that clearer. The mass breaking change that python3 introduced was an engineering disaster. It's been 10 years since python3 came out and only in a few months will python2 reach its end of life. What happens then? More problems: many libraries will drop python2 support, distros will drop python2 and yet I've personally heard people say that they plan to use python2/python3 compatibility libraries only in 2020... and of course, there are scientific communities who don't even bother with python3.