4 ms·
I think given the naive algorithm of both implementations, and the fact the python and cpp are near transliterations of each other, the article isn't really try
by Farmadupe 6y ago
I think given the naive algorithm of both implementations, and the fact the python and cpp are near transliterations of each other, the article isn't really trying to make the literal statement of the words of its title. Of course the relationship between language semantics and actual raw performance on real hardware is probably a neverending topic.
I guess the article is more trying to make a statement along the lines of "here's how you benefit if you know python and pretend that means you know CPP too", (which seems like a fairly valid way to suck people into learning CPP to me)
- adsharma 6y agoshameless plug: https://github.com/adsharma/py2many https://github.com/adsharma/py2many I didn't write the python -> C++ transpiler, but added a few features to common and added basic support in 6 other languages. It should be possible to generate the C++ from python.
- Rochus 6y agoInteresting. Do you have performance data (e.g. all CLBG Python benchmarks transpiled to C++ and run)? What's the speed-up?
- adsharma 6y agoI haven't focused on performance yet. Thanks for the pointer! Gives me a concrete target to go after. https://github.com/adsharma/py2many/tree/main/tests/expected https://github.com/adsharma/py2many/tree/main/tests/expected is a good place to understand what types of code this system can transpile. Most languages are using templates/generics/auto etc. I added some type inference capabilities to common code and updated dart to take advantage of it. Should be possible for other languages as well. btrees python -> C++/rust seems feasible as a point of comparison. Hard problem: translating library calls from one language to another. I'm thinking of some type of a plugin system that app developers can provide mappings.