good chemistry is complicated,
and a little bit messy -LW
Object Matching, speed issueby PerlingTheUK (Hermit)
|on Aug 25, 2004 at 18:22 UTC
PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
I have an object oriented data structure with singleton objects. These objects hold a number of database rows as as a kind of parent. I now want to create a function that matches such objects individually. For eaxample for a table with drinks I would like to get all drinks, that are without sugar but are black.
My database contains a couple of thoiusands of such objects. I have a function calles match that receives a hash with the column name and the content.
does what an equal SQL query
My match function is as follows:
This is extremely slow. Due to hundreds of calls to eval. Does anyone have any ideas how to speed things up a bit, without changing the whole data structure?
As you can see I have speeded up the whole process by saving all "single-column" matches, this is currently not memory critical but might become so I might really need to get anything faster to come around getting rid of this performance bit either.