[Qgis-developer] Benchmarking QgsExpression against V8

Martin Dobias wonder.sk at gmail.com
Tue Jan 10 08:03:24 EST 2012


On Tue, Jan 10, 2012 at 1:00 AM, Pirmin Kalberer <pi_ml at sourcepole.com> wrote:
>
> Pros:
> -Better performance
> -Full Javascript language set included
> -Possibility for writing custum functions
>
> Cons:
> -New language for expressions
> -More fat (3.7MB for libv8.so)

Thanks for the benchmark.

I have several things to note:
- it may be interesting to measure the proportion of time necessary
for field calculation / searching. I believe the the evaluation takes
just a small amount of time compared to time required for fetching of
features, therefore a fast engine might not necessarily speed things
up significantly
- V8 may be aware of the fact that the benchmarked expressions are
constant - and evaluate them during compilation, resulting in much
shorter execution time. It would be good to include a benchmark that
uses variables (column references).
- the engine implements three value logic (true/false/unknown) like in
SQL, while JavaScript (AFAIK) uses usual two value (true/false) logic.
How would you add support for NULL values in operators?
- Python is another language which could be used for the expressions -
with similar advantages as JavaScript

At some point we may support several languages for expressions
(ideally with just one evaluation engine). Regarding JavaScript, as
Juergen noted, there is already JavaScript engine in Qt, so adding V8
dependency looks like a high cost for the exchange of faster
expression evaluation. My impression is that such a state of the art
engine makes sense for web apps with thousands of lines in JavaScript,
but not that much for simple expressions.

Regards
Martin


More information about the Qgis-developer mailing list