DWScript news: classes, exceptions, speedups
- class visibility is now enforced: private and protected are equivalent to Delphi’s strict private and strict protected. Other levels are public (members accessible to the whole script) and published (default visibility, to be used for external exposure, RPC, persistence, etc.)
- added support for class abstract and class sealed: an abstract class has to be subclassed before it can be instantiated, a sealed class can’t be subclassed.
- virtual methods are now based on a Virtual-Method Table, previously they were implemented in a way vaguely similar to Delphi’s “dynamic” methods. The new implementation is much faster, but at the cost of a (hopefully reasonable) memory overhead. VMTs are shared, and thus only use memory for classes that actually introduce or override a virtual method.
- fixes and improvements to the exception handling (ExceptObject now available).
- fixes to the circular reference garbage collector.
- fixes and improvements to the virtual class methods support, and properties based on class methods.
- class-less procedures and functions calls are now faster.
- partial inlining loop unrolling optimization for small statement blocks*.
- other misc. optimizations, improvements and fixes.
There is also a new JSON support unit, which isn’t currently used by DWS, but has been introduced for testing and investigations. The strict JSON parser is AFAICT about twice faster than the current “fastest” Delphi JSON parser, with still some room for improvements.
*: the impact of those seem to be highly CPU-dependent, f.i. on the “Mandelbrot” demo, the speedup is a few percentage points on an AMD Phenom, but about 40% on my Intel Core i5.
edit: to be more accurate, it brings the Intel processor up to the level of the AMD cpu, the code must have been hitting a weakness in the Core i5 branch predictor.