Frequently Asked Questions¶
Is Batavia a source code converter?¶
Isn’t this the same thing as Brython/Skulpt/PyPy.js?¶
The biggest advantage of the Batavia approach is size. By only implementing the virtual machine, Batavia weighs in at around 400kB; this can be trimmed further by using tree-shaking to remove parts of Batavia that aren’t used at runtime. This compares with 5MB for PyPy.js.
The easiest way to demonstrate the difference between Brython/Skulpt/PyPy.js and Batavia is to look at the eval() and exec() methods. In Brython et al, these are key to how the process works, because they’re just hooks into the runtime process of parsing and evaluating Python code. In Batavia, these methods would be difficult to implement because Batavia compiles all the class files up front. To implement eval() and exec(), you’d need to run Batavia through Batavia, and then expose an API that could be used at runtime to generate new bytecode content.
How fast is Batavia?¶
Faster than a slow thing; slower than a fast thing :-)
Programming language performance is always nebulous to quantify. As a rough guide, it’s about an order of magnitude slower than CPython on the same machine.
It should also be noted that Batavia is a very young project, and very little time has been spent on performance optimization. There are many obvious low hanging performance optimizations that could be explored as the project matures.
What can I use Batavia for?¶
What version of Python does Batavia require?¶
Batavia runs under Python 3.4, and compiles Python 3.4 compatible bytecode.
On 27 October, 1628, Commandeur Francisco Pelsaert took command of the Batavia, and with 340 passengers and crew, set sail from Texel. Their destination? The Spice Islands - or more specifically, island of Java in the Dutch East Indies (now part of Indonesia).
The Batavia was… a Java ship (rimshot!).
Interestingly, during the voyage, Ariaen Jacobsz and onderkoopman Jeronimus Cornelisz incited a mutiny, because they didn’t want to go to Java - they wanted to escape to start a new life somewhere else. As a result of the mutiny, on 4 June 1629, the Batavia ran aground on Morning Reef, part of the Houtman Abrolhos, about 450km North of Perth, Western Australia, where this project was conceived.
The full story of the Batavia is known to most Western Australian schoolchildren, and is a harrowing tale of intrigue, savagery, and murder. It serves as a reminder of what can happen when you force people to go to Java :-)
The wreck of the Batavia was recovered in the 1970s, and now stands in the shipwrecks gallery of the Western Australian Maritime Museum.