In the php coding of RAP, some of the function of a class may 'include_once' another php document, which will badly reduce the performance of the RAP.
I find it (just an example, may happen somewhere else) in the Resource class.
The getLocalName() and getNamespace() will include/run the whole package_utility (RdfUtil.php & FindIterator.php) script every time the function is called.
It greatly reduce the performance of Model::writeAsHtml() function.
The simple method is NEVER include any other php script file in a function (especially usually called), but place the include on the top of the script instead.
(e.g. for Resource class , I placed the include_once "..." before the declaration of the class, that's is top of the script)
I've record the running time of the writeAsHtml before and after modify.
my system : apache + php + mysql , cpu Althon 1800Mhz
Before modify the Resource class :
For an about 40 statement model, it take me average 0.13 second.
After modify :
it take average 0.04 second only.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
thanks this suggestion. You are right that it's better to include the package at the top of the script. We will implement this in our next release.
Thanks for Your efforts,
Tobias Gauss
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the php coding of RAP, some of the function of a class may 'include_once' another php document, which will badly reduce the performance of the RAP.
I find it (just an example, may happen somewhere else) in the Resource class.
The getLocalName() and getNamespace() will include/run the whole package_utility (RdfUtil.php & FindIterator.php) script every time the function is called.
It greatly reduce the performance of Model::writeAsHtml() function.
The simple method is NEVER include any other php script file in a function (especially usually called), but place the include on the top of the script instead.
(e.g. for Resource class , I placed the include_once "..." before the declaration of the class, that's is top of the script)
I've record the running time of the writeAsHtml before and after modify.
my system : apache + php + mysql , cpu Althon 1800Mhz
Before modify the Resource class :
For an about 40 statement model, it take me average 0.13 second.
After modify :
it take average 0.04 second only.
Hi,
thanks this suggestion. You are right that it's better to include the package at the top of the script. We will implement this in our next release.
Thanks for Your efforts,
Tobias Gauss