leowoerteler / basex Goto Github PK
View Code? Open in Web Editor NEWThis project forked from basexdb/basex
BaseX Main Repository.
Home Page: http://basex.org
License: BSD 3-Clause "New" or "Revised" License
This project forked from basexdb/basex
BaseX Main Repository.
Home Page: http://basex.org
License: BSD 3-Clause "New" or "Revised" License
User-defined functions should be inlined where possible, eliminating the call overhead and enabling more optimizations.
declare function local:foo($x as xs:integer) as xs:integer {
if($x lt 100) then $x
else 100
};
2 * local:foo(21)
After inlining this would be
2 * (
let $x as xs:integer := 21
return
if($x lt 100) then $x
else 100
)
which BaseX can evaluate at compile-time:
Compiling:
Result: 42
Some of the proposed optimizations may also take place at run-time:
Could save a lot of byte-array copying and make comparisons easier.
This is a largely unreviewed list of papers revolving around XQuery and query optimizations. Some of them include compile-time optimizations:
Currently BaseX implements XQuery sequences as lightweight array lists, which is fast for simple use cases, but breaks down completely when sequences are used as immutable lists because of the copying overhead.
The standard XQuery function fn:map($f, $xs)
applies the function $f
so all elements of the sequence $xs
, concatenating the results. Implementing it in XQuery is straight-forward:
declare function local:map(
$f as function(item()) as item()*,
$xs as item()*
) as item()* {
if(empty($xs)) then ()
else (
$f(fn:head($xs)),
local:map($f, fn:tail($xs))
)
};
Unfortunately the function performs very poorly, as the result sequence has to be copied in every recursive call, which leads to an O(nĀ²) runtime (with n being the length of the list).
Finger trees are an immutable, purely functional data structure with properties nicely fitting this use case:
cons
, reverse
, tail
: amortized O(1)append
and split
: O(log n)Even if should not be replaced by finger trees, an option to turn them on would be nice for idiomatic functional XQuery code.
Build-in functions are currently hardwired into BaseX, a uniform plugin architecture would be cleaner and nicer to external users.
compile()
and optimize()
in all expressionsA declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.