SamplingProfiler v1.7.5

September 2nd, 2010

A new version has been released which adds support for the new Delphi XE paths, you can download it here.

Note that there is still a pseudo-random issue of unknown origin under Windows 7, where the utility may or may not be able to gather profiling information. If that happens, close the application and launch it again. The issue doesn’t happen with Windows OSes before 7.

Eric News , ,

Things on the radar for DWS

August 30th, 2010

Or a roadmap of sorts. The basic idea is to maintain forward compatibility for the “external” aspects: the language and the components. At the same time, the internals of DWS will be subject to evolution, incremental Darwinian evolution, rather than a straight break into some next-gen architecture.

The main goals:

  • Strong typing: this is a long term goal of dropping “Eval : Variant” methods, and ultimately, the reliance on Variant. Variants will stay in the scripting language though, but may become optional (see below). Changes will be incremental, with new methods and classes popping into existence, some as temporary glue, and other bits of code will fade away. What this means is that you shouldn’t rely on the internals classes, their methods, or even their still being there down the road.
  • Expression tree: this is an architectural goal of keeping the expression tree “understandable” and maintainable. Even though specialized classes may come to abound, higher level classes will be maintained to keep the expression tree easy to understand and maintain. This is to allow using the expression tree as a specialized DOM, facilitate debugging, refactoring, static analysis, etc.
  • Custom primitive types: allow optional primitive types to be plugged into the compiler, I’m thinking primarily of Variant, date-time, vectors and matrices at this time. From a language point of view, this could also mean optionally allowing operator overloading.
  • Generics/Templates: provide some mechanisms for genericity, at least on the Delphi side, so that you can f.i. have a “TList<T>” in the scripts, even if you may not be able to design a generic containers in script.
  • Local JITter: introduce a framework to simplify JITting portions of a script. The initial aim would be for math computations involving floats, vectors & matrices into SSE instructions. Complete JITting isn’t on the radar at this point, and probably shouldn’t be. This is unlikely to happen until a 64bit Delphi compiler is out.

If you want to help on the DWS compiler & runtime side, at this point the most needed things are unit tests. Can’t have too much of them :) .

Library, tools and utilities front:

DWS2 came with a rather vast set of companion libraries, tools and utilities, covering many things from HTML web page generation to auto-completion support functions. At this point I will not focus on those, but on the core aspects mentioned above.

There are however a few RTL-like sets of libraries still to be released, TStringList, TStringBuilder, TXxxxList, file access, etc. all these providing extra optional functionality for the scripts.

If some of you want to help on that front, or need some of the treasures from the old DWS2 chest, they can go ahead and bring the old code up to Unicode Delphi, things should be compatible for the most part on the DWS side apart from a few name changes.

Documentation:

A natural choice would be the google code wiki facility, but it’s very primitive to say the least. Another possibility is wikia, but I’ve no idea how easy it would be to export/backup a wikia wiki at this point, should wikia go the way of the Dodo. Another option would be a no-database, xcopy-installable, portable wiki like PmWiki. I’m still looking around, if you’ve suggestions.

Eric News

DWScript first bits now available

August 24th, 2010

They are released in the SVN source repository on google code, at

http://code.google.com/p/dwscript/

The core compiler and some internal libraries are there, along with a few unit tests, but no demos just yet. It’s compatible with Delphi 2009 (and 2010?) only at this point.

Hopefully some demos will be added, ad interim, you’ll have to look at the unit test source to see how to compile your own scripts. More modules should also come in the next weeks/months as their dependencies get cleaned up, and the dust of many years shaken away.

Here is a quick summary of the most significant changes since DWS2:

What changed in the script language?

  • DateTime type was deprecated, in favor of plain old Float for timestamps.
  • Integer is now an Int64. For language simplicity, there is only one integer type, 64bit it is.
  • Strong typing is more strictly enforced throughout, this can cause issues in previous scripts that abused compiler bugs.
  • Support for “deprecated” warnings was added.
  • for loop variables can no longer be altered within the loop.

What changed internally?

  • Move to strong typing away from Variants, this is still a work in progress (and source of much speedups).
  • Handling of break/continue/exit no longer relies on exceptions (it’s now orders of magnitude faster).
  • Expression tree memory usage reduced significantly, this is also still a work in progress.
  • Tokenizer was re-architectured for higher parsing speed.
  • Naming prefix was simplified from “dws2″ to just “dws”, though the code is based on DWS2.

Eric News

Informal DelphiWebScript performance tests

August 20th, 2010

I’ve made some informal performance tests on DWS vs PascalScript vs Delphi.

The PascalScript version was downloaded yesterday, though when compiling, I got many warnings hinting its code hasn’t been fully upgraded to Unicode and D2009, so maybe it wasn’t the latest version? I’m not a user of PascalScript, so if anyone want to chime in, feel free!

The script I used for testing was something like

var s, i: Integer;
for i:=1 to 1000000 do s:=s+i;

with only minimal syntax adaptations to get it running and compiling in the various environments. For PascalScript, I tweaked the “sample1″ project to run the script, so maybe there were some optimization options not active? If so, let me know!
The result timings on my machine were (including compilation and execution, except for Delphi):

Delphi: <1 msec (using 32bit integers), 1.5 msec (using 64bit integers)
DWS2 revival: 150 60 msec in D2009 (using 64bit integers)
DWS2 vanilla: 420 msec in D7 (using 32bit integers)
PascalScript: 1860 msec in D2009, 1490 msec in D7 (using 32bit integers)

Note that in DWS2 revival, integers are 64bit integers (more on that and other changes later).

I then redid the test using a double precision float for the “s” variable: Delphi goes up to 15 msec, DWS2 revival increases to 180 95 ms (vs 670 ms for vanilla), PascalScript results were unchanged.

Last test consisted in moving the “s:=s+i” to a function, to measure the call overhead. Delphi laughed at me and stayed with roughly the same figures, PascalScript went up to 3000 msec, and DWS2 revival took a hit to 1000 msec. Function calls are indeed a DWS area with still some simplifications and optimizations potential ;)

As for the re-release time-frame, I’m waiting to hear from the original maintainers, as well as removing a few dependencies to make it into a standalone library (currently the compiler itself is standalone, but the DWS library equivalents of system & sysutils units aren’t).

edit 2010-09-01: following a round of cleanup and optimizations, figures for DWS revival are now 60 and 95 msec for 64bit integers and floats respectively.

Eric News

DelphiWebScript Revival

August 19th, 2010

I’m planning a mini resurrection of former DelphiWebScript (by Matthias Ackermann) which has been dormant for a few years already.

DWS is a 100% Delphi-based Delphi-language script engines, that supports a fairly large subset of the Delphi language (including objects), with a performance high enough for use in real-time scenarios (simulators, game engine scripting…).

We’ve been making use of the library at work for years now, with it receiving updates covering a variety of things from Delphi compatibility, to language enhancements to speed or memory usage optimizations. On the other hand, the parts we didn’t use fell significantly behind (to the point of deprecation), and wouldn’t be part of the revival (unless some extra hands join in for the update).

However, most emails and websites from back then have gone the way of the Dodo, so this post is mostly a call to former DWS2 maintainers, contributors and users to make themselves known if they are interested… if they are still using DWS2 in some form or another, or if they are merely just still around to share memories of a bygone era ;)

Eric News