google-code-backups / rsslounge

Automatically exported from code.google.com/p/rsslounge
0 stars 0 forks source link

Settings validation is inefficient #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Do anything that will cause application_models_settings.validate() to be 
called (e.g. clicking a feed in the feed list).

What is the expected output? What do you see instead?
The items display should be updated quickly; instead, it takes some time.

What version of the product are you using? On what operating system?
Linux, PHP 5.3.3, Apache 2.2.17, rsslounge r135

Please provide any additional information below.
I'm running rsslounge on a pretty slow server. Updating the items view, as 
described, takes 5 seconds or more. I've used xdebug to profile the execution 
of rsslounge on the server and noticed that around 80% of the execution time is 
spent in the function application_models_settings.validate(). More precisely, 
Zend's locale system, which is being called by the validators, seems to be a 
problem. (I've attached a cachegrind file displaying the problem.)

By simply replacing the $validators array in 
application_models_settings.validate() by an empty array ($validators = 
array();), I've been able to cut item update time to less than half.

I propose to investigate a) whether Zend can be used to perform settings 
validation in a more efficient way, or b) whether it would be wise to write 
custom filtering functions to improve efficiency.

Since I'm probably the only one using rsslounge on hardware this old, I could 
look into this as soon as I have time. However, that may be a while.

Original issue reported on code.google.com by sbesc...@gmail.com on 1 Dec 2010 at 2:20

Attachments:

GoogleCodeExporter commented 8 years ago
This is a generally problem of frameworks. Thats the price for a good and clean 
application structure. But I will check this issue the next days and do a 
performance check myself.

Original comment by zzuzzlwuzzl@googlemail.com on 2 Dec 2010 at 6:48

GoogleCodeExporter commented 8 years ago
I'd be happy if you'd notify me (personally or via this comment thread) about 
what you think after performing your own checks.

I'm not suggesting to abolish the Zend framework altogether, but in this case, 
an unreasonable amount of processing time is taken up by settings validation - 
something that is not by its nature a difficult computing problem. Certain 
functions in the Zend locale system are called over 16,000 times and don't seem 
to be generally necessary. So my suggestion would be - without nowing too much 
about the Zend functions in questions - to replace some functions that are 
inefficient in this case by (possibly custom-written) non-locale-specific ones; 
I'm sure this could be done in a way that integrates well with the framework.

E.g. I don't think locale access is really needed for number conversion if 
numbers are just stored internally. They could be converted into a standard 
format the moment they're input and a simpler, non-localized parser could be 
used from then on.

Since this probably isn't an issue that affects a lot of people as badly as it 
does me, I'd be OK fixing it myself as I get around to it, so long as you'd 
agree to merge it into the trunk as soon as it's done.

Original comment by sbesc...@gmail.com on 2 Dec 2010 at 8:42