Inappropriate "eval" usage in kBase::makeClass method (optimization)

2 views
Skip to first unread message

Alexander Obuhovich

unread,
Dec 18, 2009, 12:02:50 PM12/18/09
to In-Portal Development
Method kBase::makeClass is calling ref_call_user_func_array no matter if he has only class name or class name + constructor arguments passed. This slows downs the things a little bit. I propose to use code, mentioned above, that was called from kFactory class to optimize things.

if ( func_num_args() == 1 ) {
    $class = new $real_class();
}
else {
    $func_args = func_get_args();
    $pseudo_class = array_shift($func_args);
    $class =& ref_call_user_func_array( Array ($real_class,'makeClass'), $func_args );
}

--
Best Regards,

http://www.in-portal.org
http://www.alex-time.com

Alexander Obuhovich

unread,
Dec 18, 2009, 12:06:12 PM12/18/09
to In-Portal Development
Also kDBLIst class constructor during filter creation calls makeClass 13 times, but there are only two class types it creates, so we could create two classes and just clone them to create other fiters. Here is problematic code:

$filters = $this->getFilterStructure();

foreach ($filters as $filter_params) {
    $filter =& $this->$filter_params['type'];
    $filter[ $filter_params['class'] ] =& $this->Application->makeClass('kMultipleFilter', $filter_params['join_using']);

Dmitry A.

unread,
Dec 18, 2009, 12:08:31 PM12/18/09
to In-Portal Development
Thanks Alex,

Okay, do you think we should include this improvement in 5.0.2 or
5.1.0 release?


DA.

Alexander Obuhovich

unread,
Dec 18, 2009, 12:10:36 PM12/18/09
to in-por...@googlegroups.com
Sure, why not.

--

You received this message because you are subscribed to the Google Groups "In-Portal Development" group.
To post to this group, send email to in-por...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-dev?hl=en.


Alexander Obuhovich

unread,
Dec 23, 2009, 3:25:03 AM12/23/09
to in-por...@googlegroups.com
I've created corresponding task: http://tracker.in-portal.org/view.php?id=475 (0000475: Inappropriate "eval" usage in kBase::makeClass method).
Reply all
Reply to author
Forward
0 new messages