#6112: Speed enhancement for TreeBehavior::reorder()
---------------------------------------------+------------------------------
    Reporter:  palam                         |          Type:  Enhancement
      Status:  new                           |      Priority:  Medium     
   Milestone:  1.2.x.x                       |     Component:  General    
     Version:  1.2 Final                     |      Severity:  Normal     
    Keywords:  treebehavior, reorder, speed  |   Php_version:  PHP 5      
Cake_version:                                |  
---------------------------------------------+------------------------------
 TreeBehavior::reorder() currently doesn't check if a node has to be moved
 before moving it. AD7six pointed this out at #cakephp and suggested I
 submit an enhancement if I can make it faster.[[BR]][[BR]]
 I've used two slightly differing methods that pretty much use the same
 algorithm. One is faster and uses fewer queries, while the other is
 prettier. I'm attaching the two patch files with this ticket. I've run the
 TreeBehavior tests on these patches and they both pass.[[BR]][[BR]]
 Running only the reorder test multiple times, here are the numbers on my
 laptop (1GHz PB G4, with 1.25GB RAM):[[BR]]
 Current code: 1362 queries ~4.5s[[BR]]
 Pretty version: 642 queries ~3s[[BR]]
 Fast version: 579 queries ~2.2s[[BR]][[BR]]
 This is the first patch I'm submitting, so if I've erred in the coding
 style (I've tried not to), please forgive :-)[[BR]][[BR]]
 As a side note - and this may be obvious when you see the code: I
 implemented the algorithm I worked out today and haven't checked for
 better algorithms.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6112>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to