Updates from diegocaro Toggle Comment Threads | Keyboard Shortcuts

  • diegocaro 8:29 pm on August 17, 2009 Permalink
    Tags: ,   

    Hello everyone, since my last update I f… 

    Hello everyone, since my last update I fixed some bugs about upgrade and some strings for update the mysql.

    Finally, I can say that the speedup wasn’t much superior, maybe get the lft and rgt values in the sql queries add more time in the process. But I have a good news, the speedup in Edit Pages section in admin panel have a good acceleration, see the chart: http://spreadsheets.google.com/pub?key=tvUiOf6bEO5A55cMLjbDTdw&output=html

    The last patch is in http://dl.getdropbox.com/u/173207/diff-20090817.patch . Remember, only apply the patch on a test WordPress installation.

    Thanks to all, these months were really good ;).

  • diegocaro 7:30 pm on August 10, 2009 Permalink
    Tags: , ,   

    Hi everyone, finally I have the patch fo… 

    Hi everyone, finally I have the patch for MPTT in categories and Pages.

    Download the update-pack in http://dl.getdropbox.com/u/173207/pack_20090810.tar.gz

    The update-pack includes the patch for WordPress (developer version at today), and two plugins called MPTT, and MPTT-test.

    The first plugin MPTT, include a little code for view the tree data in categories and pages (only for view and check the results of add/edit nodes). And with the second plugin MPTT-test, you can insert artificial tree data (hundred and thousands nodes) into categories and get the speedup MPTT V/S Recursive way for get categories.

    Remember install the diff patch only in a not important WordPress installation.

    Bye bye, and good luck with the tests!

  • diegocaro 7:01 pm on August 4, 2009 Permalink
    Tags: ,   

    Hi everyone, This week I been patching… 

    Hi everyone,

    This week I been patching the core of WP, and modifying the admin panel for use MPTT (categories and page sections). I will change the recursive mechanism for get the path of a node by the non-recursive way that use MPTT.

    If all go ok, the patch will be ready on the next week.

    Bye bye.

  • diegocaro 4:43 am on July 29, 2009 Permalink
    Tags: ,   

    Hello everyone, this week i’m making th… 

    Hello everyone, this week i’m making the code for pages, and migrating the mptt plugin to the core of WordPress (for get a patch).

    I’m still reading and trying to get more performance for get the tree.

    Bye bye!

  • diegocaro 4:06 am on July 14, 2009 Permalink
    Tags: ,   

    Hello everyone, this week had been slow…. 

    Hello everyone, this week had been slow. I only change the stack for managing the depth on the tree [because this week was my final week in the university 🙂 ].
    BTW, this and the next week the code develop will be stopped (I’m going to vacations).

    When I’ll be back, I will check why my code only get 7-10% of speedup.

    Bye bye… and happy coding!

  • diegocaro 7:46 am on July 8, 2009 Permalink
    Tags: ,   

    Hello :), This week has been test, test,… 

    Hello :),
    This week has been test, test, test, test with a lot of categories. To do the test with categories, I wrote code for another way of insert categories in mysql (without WordPress functions and MPTT functions), because the WP execution was stopped by php (stopped by max_time_execution and memory limit when I try to insert 20000 to 100000 categories).
    The idea is get the inserts statements for to can do “one big insert” using only text, executing the script and insert directly to the database [ example: php -n insert-sql.php | mysql -u user -ppass wp_db]. The script is in mptt-test/insert-sql.php .

    For get the speedup, I get the categories 5 times and calculate the time of execution with the code:
    $start = microtime( true );
    mptt_wp_dropdown_categories( $args );
    $finish = microtime( true );
    $total = $finish – $start;

    The speedup is beetwen 7-10% with synthetic data (20000 to 100000 categories with depth 5), and real XML data. You can see the results in http://spreadsheets.google.com/pub?key=tWef2b-aEpdU5LOFwUe65DA&output=html .

    Now, the code for categories goes ok (I coded a plugin that extends the core functions for test the mptt). When you install the mptt plugin, automatically add new fields of the database with metadata. In the admin panel you can view the tree of categories using mptt menu.
    With mptt-test you can insert artificial data into database, for make test or benchmark the algorithm.

    You can see the plugin code of mptt, mptt-test and little patch to core in http://files.getdropbox.com/u/173207/mptt-pack.zip (this pack have a bug) http://files.getdropbox.com/u/173207/pack_fixed.zip

    Feel free for test, modified, reuse the code ;).

    Bye byeee

    • diegocaro 8:17 am on July 8, 2009 Permalink

      D’oh, my mptt algorithm have a bug.

      When some categories doesn’t have posts, they are deleted from the results (in get_terms function), so when the algorithm in walk() method (class MPTT_Walker), can’t get the next depth of the tree. This is because I use a “for bucle” for traverse the results of function get_terms.

      The solution is easy, only change the way of get the next depth :).

  • diegocaro 6:45 am on June 28, 2009 Permalink

    I have some results of my project… you… 

    I have some results of my project… you can see two charts with the percent of acceleration, comparing the previous method for hierarchical data and the new with MPTT (:

    See in http://spreadsheets.google.com/pub?key=rYXHXcnoiszu0YuR5UWvFFQ

    • Dan Larkin 2:54 pm on June 29, 2009 Permalink

      It seems like you’ve got some pretty solid testing methods worked out. I’m wondering how you’re getting it all done (how you’re populating your database, specifically). Perhaps if we can both test in a similar fashion we can see how our code differs with respect to various tasks. So in other words, I’d like to know how to duplicate your testing conditions. 😀

      • diegocaro 1:46 am on July 1, 2009 Permalink

        Yes Dan, I think the same thing. The test is simple, I use two ways for populate the database.
        The first method consist in a “artificial” way, inserting nodes with a number of childs with a max depth. For example, nodes with 3 childs and max depth 3 (this configuration will insert 3^4 -3 nodes).
        The second method is load a xml file, and upload the tree of the file (any xml document can be transformed to a tree).

        For benchmark the old method for get categories and MPTT, I execute a function for print categories with wp_list_categories() function. I perform the function 10 times and then averaged for MPTT and old method.

        You can see the plugin for test in http://github.com/diegocaro/MPTT-for-WordPress/tree/b6a0a7c9cb104e9b009284e5015aee78b37d2c64/wp-content/plugins/mptt-test . Feel free to improve and change the plugin for testing ;).

  • diegocaro 7:03 pm on June 24, 2009 Permalink
    Tags: ,   

    Hello, for all :). I’m currently workin… 

    Hello, for all :). I’m currently working on a test for MPTT, the test is not ready yet. I’m importing the data from http://www.geonames.org/ . Maybe the next weekend I will get some results.

    I work too in a special pages of the plugin (in the admin section) for rebuild the tree, and show the tree data.

    Thats all… this week wasn’t very productive (I’m in exams period again, maybe my last exams period in the uni xD).

  • diegocaro 6:20 am on June 17, 2009 Permalink
    Tags: , ,   

    Hello, this week I worked on a class for… 

    Hello, this week I worked on a class for update the tree, this class include an algorithm for reindex tree (when you migrate from the old method for get tree data), update a node when WP add a new category or edit an existent category.

    But I have a problem when a category was deleted , the action hook (called delete_category) doesn’t show the right and left field of the deleted category, for solve it I execute the method for reindex, but I think that is bad because use some resources. Maybe I will modify the delete_category hook to show data in the category before it is removed.

    I added a column called depth, only for get more faster the tree data (I need prove it).

    For the next week, I will add functions for install and remove the plugin, better code for my mptt_walker class [I have a problem when max_depth is active] and I will search code for make tests.

    Bye byeeeee

  • diegocaro 12:07 am on June 13, 2009 Permalink
    Tags: ,   

    Hello for all, sorry for my late update … 

    Hello for all, sorry for my late update (I was in a special course of Database Integration during this week).
    This week, I worked on save items. For that, I used actions called “created_category, updated_category, delete_category).

    The point is that I don’t will modify the native functions of taxonomy because I will write the code for to use actions.

    For the next week the code for create, update and delete tree data (in categories) will be finished. Also I’ll be working on functions for migrate the old tree data to mptt tree data.

    Bye byee

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc