title: Performance and optimization codeigniter
body: <p>I wonder which of these two forms is more efficient in Codeigniter.
  In option 1 the data array is passed to all views.
  In Option 2 each data array has a different name doing to not forget all the info
  to each view.
  I want to assume that Option 2 is correct, I mean rename each array, not spend
  unnecessary information to each view.
  Am I correct? Codeigniter or not it matter?
  Thanks for reading the post
  regards</p>
  
  <p>OPTION 1</p>
  
  <pre><code>public function alguna_funcion(){
  
  
         $data['datos1'] = $this-&gt;modelo-&gt;function1();
         $data['widget1'] = $this-&gt;load-&gt;view('widget1',$data,TRUE);
         $data['datos2'] = $this-&gt;modelo-&gt;function2();
         $data['widget2'] = $this-&gt;load-&gt;view('widget2',$data,TRUE);
         $data['datos3'] = $this-&gt;modelo-&gt;function3();
         $data['widget3'] = $this-&gt;load-&gt;view('widget3',$data,TRUE);
         $data['datos4'] = $this-&gt;modelo-&gt;function4();
         $data['widget4'] = $this-&gt;load-&gt;view('widget4',$data,TRUE);
  
         $this-&gt;load-&gt;view('home_view',$data);
  
  
     }
  </code></pre>
  
  <p>OPTION 2</p>
  
  <pre><code>public function alguna_funcion(){
  
  
         $data1['datos1'] = $this-&gt;modelo-&gt;function1();
         $data['widget1'] = $this-&gt;load-&gt;view('widget1',$data1,TRUE);
         $data2['datos2'] = $this-&gt;modelo-&gt;function2();
         $data['widget2'] = $this-&gt;load-&gt;view('widget2',$data2,TRUE);
         $data3['datos3'] = $this-&gt;modelo-&gt;function3();
         $data['widget3'] = $this-&gt;load-&gt;view('widget3',$data3,TRUE);
         $data4['datos4'] = $this-&gt;modelo-&gt;function4();
         $data['widget4'] = $this-&gt;load-&gt;view('widget4',$data4,TRUE);
  
         $this-&gt;load-&gt;view('home_view',$data);
  
  
     }
  </code></pre>