Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Matthias, can you change the ownership to zorba-coders so that I can do some small changes (documentation and style)? -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
I think there is a bug in user_function::computeResultCaching, starting at line 542. The condition: if (lExplicitCacheRequest) appears twice and theCacheResults will actually be set to true if the udf is sequential or non-deterministic. -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The attempt to merge lp:~matthias-brantner/zorba/caching into lp:zorba failed. Below is the output from the failed tests. CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message): Validation queue job caching-2011-11-21T22-11-29.225Z is finished. The final status was: 3 tests did not succeed - changes not commited. Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Approved = Needs review For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Commit Message changed to: - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82787 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/caching into lp:zorba. Requested reviews: Matthias Brantner (matthias-brantner) Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2011-11-16 04:00:29 + +++ ChangeLog 2011-11-17 16:58:28 + @@ -54,6 +54,8 @@ xs:anyAtomicType or xs:untypedAtomic. * Added undo for node revalidation * Optimization for count(collection()) expressions + * Caching of results for recursive functions with atomic parameter and return types. + * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types. * Fixed bug #867133 (SWIG PHP build failure on Mac OSX) * Fixed bug #872796 (validate-in-place can interfere with other update primitives) * Fixed bug #872799 (validate-in-place can set incorrect types) === modified file 'doc/zorba/options.dox' --- doc/zorba/options.dox 2011-09-14 06:15:19 + +++ doc/zorba/options.dox 2011-11-17 16:58:28 + @@ -278,6 +278,27 @@ In order to be able to use the value twice, the ttstring:materialize/tt function must be used to materialize the entire contents of the file ttmyfile.txt/tt in memory. Otherwise, the error zerr:ZSTR0055 is raised. +\paragraph caching_annotation Caching Results of Functions +Caching of function results might improve the performance if computational expensive functions are invoked multiple times with the same arguments. + +Zorba automatically caches results of recursive, deterministic, and non-sequential functions whose parameter and return types are subtypes of xs:anyAtomicType if at least optimization level O1 is used. +Specifically, if such a function is called twice with the same arguments, the result of the second call will return the same value without re-evaluating the function. + +For example, in the following recursive function computing a fibonacci number, each result is automatically cached and, hence, dramatically improves the performance. + +\include zorba/udf/udf-fib-rec.xq + +Specifically, this optimization reduces the complexity of the function from O(1.6^n) to O(n). + +In order to explicitly disable function caching, the user can specify the tt%ann:no-cache/tt annotation. + +In addition, the user can use the tt%ann:cache/tt annotation to cache the results of functions other than the ones that are automatically cached. +However, this will only work if the function is not updating and its parameter and return types are subtypes of xs:anyAtomicType. +Zorba will raise a warning if caching is explicitly enabled but the function does not meet this criteria (zwarn:ZWST0005). + +Please note, that explicitly enforcing caching for sequential or nondeterministic functions might not give the intended result. +In such cases, Zorba will raise a warning (zwarn:ZWST0006). + \paragraph collection_index_annotations Annotations on Collections and Indexes The \ref xqddf uses annotations to assign properties to collections and indexes. === modified file 'include/zorba/pregenerated/diagnostic_list.h' --- include/zorba/pregenerated/diagnostic_list.h 2011-11-15 08:23:20 + +++ include/zorba/pregenerated/diagnostic_list.h 2011-11-17 16:58:28 + @@ -600,6 +600,8 @@ extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES; +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT; + extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED; extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0032_IC_NOT_ACTIVATED; @@ -752,6 +754,10 @@ extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0004_AMBIGUOUS_SEQUENTIAL_FLWOR; +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0005_CACHING_NOT_POSSIBLE; + +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED; + } // namespace zwarn } // namespace zorba #endif /* ZORBA_DIAGNOSTIC_LIST_API_H */ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-15 08:23:20 + +++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-17 16:58:28 + @@ -501,6 +501,10 @@ (:~ :) +declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0035); + +(:~ +:) declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0031); (:~ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq 2011-11-15 08:10:49 + +++
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Commit Message changed to: - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82563 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/caching into lp:zorba. Requested reviews: Matthias Brantner (matthias-brantner) Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82482 - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82482 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2011-11-16 04:00:29 + +++ ChangeLog 2011-11-17 03:02:26 + @@ -54,7 +54,12 @@ xs:anyAtomicType or xs:untypedAtomic. * Added undo for node revalidation * Optimization for count(collection()) expressions + TREE * Fixed bug #867133 (SWIG PHP build failure on Mac OSX) +=== + * Caching of results for recursive functions with atomic parameter and return types. + * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types. + MERGE-SOURCE * Fixed bug #872796 (validate-in-place can interfere with other update primitives) * Fixed bug #872799 (validate-in-place can set incorrect types) * Fixed bug #855715 (Invalid escaped characters in regex not caught) === modified file 'doc/zorba/options.dox' --- doc/zorba/options.dox 2011-09-14 06:15:19 + +++ doc/zorba/options.dox 2011-11-17 03:02:26 + @@ -278,6 +278,27 @@ In order to be able to use the value twice, the ttstring:materialize/tt function must be used to materialize the entire contents of the file ttmyfile.txt/tt in memory. Otherwise, the error zerr:ZSTR0055 is raised. +\paragraph caching_annotation Caching Results of Functions +Caching of function results might improve the performance if computational expensive functions are invoked multiple times with the same arguments. + +Zorba automatically caches results of recursive, deterministic, and non-sequential functions whose parameter and return types are subtypes of xs:anyAtomicType if at least optimization level O1 is used. +Specifically, if such a function is called twice with the same arguments, the result of the second call will return the same value without re-evaluating the function. + +For example, in the following recursive function computing a fibonacci number, each result is automatically cached and, hence, dramatically improves the performance. + +\include zorba/udf/udf-fib-rec.xq + +Specifically, this optimization reduces the complexity of the function from O(1.6^n) to O(n). + +In order to explicitly disable function caching, the user can specify the tt%ann:no-cache/tt annotation. + +In addition, the user can use the tt%ann:cache/tt annotation to cache the results of functions other than the ones that are automatically cached. +However, this will only work if the function is not updating and its parameter and return types are subtypes of xs:anyAtomicType. +Zorba will raise a warning if caching is explicitly enabled but the function does not meet this criteria (zwarn:ZWST0005). + +Please note, that explicitly enforcing caching for sequential or nondeterministic functions might not give the intended result. +In such cases, Zorba will raise a warning (zwarn:ZWST0006). + \paragraph collection_index_annotations Annotations on Collections and Indexes The \ref xqddf uses annotations to assign properties to collections and indexes. === modified file 'include/zorba/pregenerated/diagnostic_list.h' --- include/zorba/pregenerated/diagnostic_list.h 2011-11-15 08:23:20 + +++ include/zorba/pregenerated/diagnostic_list.h 2011-11-17 03:02:26 + @@ -600,6 +600,8 @@ extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES; +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT; + extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED; extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0032_IC_NOT_ACTIVATED; @@ -752,6 +754,10 @@ extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0004_AMBIGUOUS_SEQUENTIAL_FLWOR; +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0005_CACHING_NOT_POSSIBLE; + +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED; + } // namespace zwarn } // namespace zorba #endif /* ZORBA_DIAGNOSTIC_LIST_API_H */ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-15 08:23:20 + +++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-17 03:02:26 + @@ -501,6 +501,10 @@ (:~ :) +declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0035); + +(:~ +:) declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0031); (:~ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq' ---
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82482 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82482 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/caching into lp:zorba. Requested reviews: Markos Zaharioudakis (markos-za) Matthias Brantner (matthias-brantner) For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2011-11-16 04:00:29 + +++ ChangeLog 2011-11-17 03:07:25 + @@ -54,6 +54,8 @@ xs:anyAtomicType or xs:untypedAtomic. * Added undo for node revalidation * Optimization for count(collection()) expressions + * Caching of results for recursive functions with atomic parameter and return types. + * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types. * Fixed bug #867133 (SWIG PHP build failure on Mac OSX) * Fixed bug #872796 (validate-in-place can interfere with other update primitives) * Fixed bug #872799 (validate-in-place can set incorrect types) === modified file 'doc/zorba/options.dox' --- doc/zorba/options.dox 2011-09-14 06:15:19 + +++ doc/zorba/options.dox 2011-11-17 03:07:25 + @@ -278,6 +278,27 @@ In order to be able to use the value twice, the ttstring:materialize/tt function must be used to materialize the entire contents of the file ttmyfile.txt/tt in memory. Otherwise, the error zerr:ZSTR0055 is raised. +\paragraph caching_annotation Caching Results of Functions +Caching of function results might improve the performance if computational expensive functions are invoked multiple times with the same arguments. + +Zorba automatically caches results of recursive, deterministic, and non-sequential functions whose parameter and return types are subtypes of xs:anyAtomicType if at least optimization level O1 is used. +Specifically, if such a function is called twice with the same arguments, the result of the second call will return the same value without re-evaluating the function. + +For example, in the following recursive function computing a fibonacci number, each result is automatically cached and, hence, dramatically improves the performance. + +\include zorba/udf/udf-fib-rec.xq + +Specifically, this optimization reduces the complexity of the function from O(1.6^n) to O(n). + +In order to explicitly disable function caching, the user can specify the tt%ann:no-cache/tt annotation. + +In addition, the user can use the tt%ann:cache/tt annotation to cache the results of functions other than the ones that are automatically cached. +However, this will only work if the function is not updating and its parameter and return types are subtypes of xs:anyAtomicType. +Zorba will raise a warning if caching is explicitly enabled but the function does not meet this criteria (zwarn:ZWST0005). + +Please note, that explicitly enforcing caching for sequential or nondeterministic functions might not give the intended result. +In such cases, Zorba will raise a warning (zwarn:ZWST0006). + \paragraph collection_index_annotations Annotations on Collections and Indexes The \ref xqddf uses annotations to assign properties to collections and indexes. === modified file 'include/zorba/pregenerated/diagnostic_list.h' --- include/zorba/pregenerated/diagnostic_list.h 2011-11-15 08:23:20 + +++ include/zorba/pregenerated/diagnostic_list.h 2011-11-17 03:07:25 + @@ -600,6 +600,8 @@ extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES; +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT; + extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED; extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0032_IC_NOT_ACTIVATED; @@ -752,6 +754,10 @@ extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0004_AMBIGUOUS_SEQUENTIAL_FLWOR; +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0005_CACHING_NOT_POSSIBLE; + +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED; + } // namespace zwarn } // namespace zorba #endif /* ZORBA_DIAGNOSTIC_LIST_API_H */ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-15 08:23:20 + +++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-17 03:07:25 + @@ -501,6 +501,10 @@ (:~ :) +declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0035); + +(:~ +:) declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0031); (:~ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq 2011-11-15 08:10:49 + +++
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Commit Message changed to: - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Review: Approve -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions. -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Approved = Needs review For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/82483 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/caching into lp:zorba. Requested reviews: Matthias Brantner (matthias-brantner) Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 - automatic caching of recursive, non-sequential, and deterministic functions with atomic parameter and return types - %ann:cache and %ann:no-cache for controlling function result caching -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2011-11-04 11:40:20 + +++ ChangeLog 2011-11-04 17:27:25 + @@ -54,6 +54,8 @@ xs:anyAtomicType or xs:untypedAtomic. * Added undo for node revalidation * Optimization for count(collection()) expressions + * Caching of results for recursive functions with atomic parameter and return types. + * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types. * Fixed bug #872796 (validate-in-place can interfere with other update primitives) * Fixed bug #872799 (validate-in-place can set incorrect types) * Fixed bug #855715 (Invalid escaped characters in regex not caught) === modified file 'doc/zorba/options.dox' --- doc/zorba/options.dox 2011-09-14 06:15:19 + +++ doc/zorba/options.dox 2011-11-04 17:27:25 + @@ -278,6 +278,27 @@ In order to be able to use the value twice, the ttstring:materialize/tt function must be used to materialize the entire contents of the file ttmyfile.txt/tt in memory. Otherwise, the error zerr:ZSTR0055 is raised. +\paragraph caching_annotation Caching Results of Functions +Caching of function results might improve the performance if computational expensive functions are invoked multiple times with the same arguments. + +Zorba automatically caches results of recursive, deterministic, and non-sequential functions whose parameter and return types are subtypes of xs:anyAtomicType. +Specifically, if such a function is called twice with the same arguments, the result of the second call will return the same value without re-evaluating the function. + +For example, in the following recursive function computing a fibonacci number, each result is automatically cached and, hence, dramatically improves the performance. + +\include zorba/udf/udf-fib-rec.xq + +Specifically, this optimization reduces the complexity of the function from O(1.6^n) to O(n). + +In order to explicitly disable function caching, the user can specify the tt%ann:no-cache/tt annotation. + +In addition, the user can use the tt%ann:cache/tt annotation to cache the results of functions other than the ones that are automatically cached. +However, this will only work if the function is not updating and its parameter and return types are subtypes of xs:anyAtomicType. +Zorba will raise a warning if caching is explicitly enabled but the function does not meet this criteria (zwarn:ZWST0005). + +Please note, that explicitly enforcing caching for sequential or nondeterministic functions might not give the intended result. +In such cases, Zorba will raise a warning (zwarn:ZWST0006). + \paragraph collection_index_annotations Annotations on Collections and Indexes The \ref xqddf uses annotations to assign properties to collections and indexes. === modified file 'include/zorba/pregenerated/diagnostic_list.h' --- include/zorba/pregenerated/diagnostic_list.h 2011-10-30 08:04:47 + +++ include/zorba/pregenerated/diagnostic_list.h 2011-11-04 17:27:25 + @@ -598,6 +598,8 @@ extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0034_INDEX_RANGE_VALUE_PROBE_BAD_KEY_TYPES; +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0035_INDEX_GENERAL_INSERT; + extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0031_IC_NOT_DECLARED; extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0032_IC_NOT_ACTIVATED; @@ -750,6 +752,10 @@ extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0004_AMBIGUOUS_SEQUENTIAL_FLWOR; +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0005_CACHING_NOT_POSSIBLE; + +extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED; + } // namespace zwarn } // namespace zorba #endif /* ZORBA_DIAGNOSTIC_LIST_API_H */ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-10-30 08:04:47 + +++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2011-11-04 17:27:25 + @@ -497,6 +497,10 @@ (:~ :) +declare variable $zerr:ZDDY0035 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0035); + +(:~ +:) declare variable $zerr:ZDDY0031 as xs:QName := fn:QName($zerr:NS, zerr:ZDDY0031); (:~ === modified file 'modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq' --- modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq 2011-10-19 15:28:51 + +++
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The attempt to merge lp:~matthias-brantner/zorba/caching into lp:zorba failed. Below is the output from the failed tests. CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message): Validation queue job caching-2011-11-04T17-29-08.827Z is finished. The final status was: 31 tests did not succeed - changes not commited. Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~matthias-brantner/zorba/caching into lp:zorba
The proposal to merge lp:~matthias-brantner/zorba/caching into lp:zorba has been updated. Status: Approved = Needs review For more details, see: https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 -- https://code.launchpad.net/~matthias-brantner/zorba/caching/+merge/81304 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp