Welcome, Guest
Username: Password: Remember me

TOPIC: Jdom: improving performances

Jdom: improving performances 12 Jun 2013 07:20 #7446

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
my thoughts about how improve performances on jcook-generated components:

- remove the dom FLY, use the simple plain item value, example:
replace all the (EXAMPLE CODE):
<?php echo JDom::_('html.fly', array(
	'dataKey' => 'title',
	'dataObject' => $row
));?>

with (EXAMPLE CODE):
<?php echo $row->title; ?>

why?
  1. mainly for better performances on long list and less server resources usage, because the jdom is not involved on this code
  2. better code view

replace all the enumlist output (EXAMPLE CODE):
<?php echo JDom::_('html.fly.enum', array(
	'dataKey' => 'type',
	'dataObject' => $row,
	'labelKey' => 'text',
	'list' => ComponentHelper::enumList('fields', 'type'),
	'listKey' => 'value'
));?>

with (EXAMPLE CODE):
<?php echo $this->lists['enum']['fields.type'][$row->type]['text']; ?>

why?
  1. the function "ComponentHelper::enumList" is called just ONCE in the view.html.php and then used for all the rows, instead of call the function N rows times. I know the function doesn't requires a lot of resources (if not modified) but it's still prefereable to avoid to call it N times for the same values.
  2. better performances on long list and less server resources usage, because the jdom is not involved on this code
  3. better code view
The administrator has disabled public write access.

Re: Jdom: improving performances 18 Jun 2013 16:29 #7564

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
You are right.

The simple html.fly seems to do nothing. Right.

But when you add some parameters :
responsive, aclAccess, etc... then you can can the visibility depending of the rights or the screen size.
It is only an example.

When you want to optimize your component, you can replace critical JDom call to their optimized code.
For example in huges lists it is better to optimize, removing JDom for the grid rows.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.116 seconds

Get Started