We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Awesome! ... keep up guys! smiley
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 11975
      • 2,542 Posts
      You can see the modified version here:

      http://dixsix.fr/moretto/

      There are 2460 docs

      The code needs improvements but performance are here !!!!
      Look at the bottom of the page for informations

      :-)

      P.S: I’ve not updated the whole site so remain on the homepage for testing.
      This site was a project I had and which has been abandoned by the customer.

      Ditto call on homepage

      [!ditto? &parents=`11552` &summarize=`99` &paginate=`1`  &filter=`isfolder,1` &tpl=`photolist2` &debug=`0`   &depth=`4` &sortBy=`menuindex` &sortDir=`ASC`  !]

      Demo is running on a shared hosting environment.
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 11975
        • 2,542 Posts
        Here is the ditto.class.inc.php modified.
        It’s not totally finished.
        I’ve just chaged the way ditto get the Tvs and doc data.
        Nothing else.


        Hope that helps.
        As said before some functions could be improved.

        Let me know Mark, if you are interested in these changes.


        :-)
          Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
          • 11975
          • 2,542 Posts
          I’ve updated the demo

          http://dixsix.fr/moretto/

          now db count: 4910 documents and it runs smoothly.

          :-)

          P.S:

          ditto call
          [!ditto? &parents=`11552,14526` &summarize=`198` &paginate=`1` &filter=`isfolder,1` &tpl=`photolist2` &debug=`0` &depth=`4` &sortBy=`menuindex` &sortDir=`ASC` !]

          MySQL: 0.6213 s, 14 request(s), PHP: 2.8423 s, total: 3.4636 s, document retrieved from database.
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 18397
            • 3,250 Posts
            @sottwell: fixed in dev code

            @helio: Clever idea! I’ll try and implement it in the codebase (I’ve changed quite a few things since Alpha 1 but its not quite ready for Alpha 2)
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Quote from: Mark at Jan 08, 2007, 07:23 PM

              @sottwell: fixed in dev code
              And that will teach me to try to use an alpha in production! Problem is you guys are so good I’ve gotten accustomed to being able to use just about anything you put out rolleyes
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 11975
                • 2,542 Posts
                Hi mark,

                i’ve rewritten the function loadChildList (which replace getChildIDs) to make it faster

                here are some results with the new one

                Same demo site ( 4928 documents in db)

                V2
                MySQL: 0.3245 s, 13 request(s), PHP: 2.2551 s, total: 2.5796 s, document retrieved from database.

                V1
                MySQL: 0.3110 s, 13 request(s), PHP: 4.8692 s, total: 5.1802 s, document retrieved from database.

                I will apply these changes to the loadParentList and post back the new functions

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 7923
                  • 4,213 Posts
                  Good stuff guys!


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 25663 MODX Staff
                    • 12,272 Posts
                    heliotrope, out of curiosity, what are you using to profile the code to see where improvements are needed, and what’s a comparable speed from ditto 1.0.2? (And good stuff, too, on top of some already good stuff (from Mark)!)
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 11975
                      • 2,542 Posts
                      Hi Ryan,

                      I’ll do my best with my basic english to explain how I have proceeded grin

                      With ditto 1.xx, I was unable to load a huge amount of docs ( this is not at a critic about ditto, I’m quite impressed by mark skills and would never have been able to write such a piece of code)
                      So I was bounded to load at max 500 docs to remain in a reasonable time to display the page.

                      When mark announced ditto 2, i’ve decided to test the same site and even if the performance were better (twice faster) I was still unable to load the whole content of the siteabout 2 400 docs at this time (I need this for tvExplorer).

                      So I decided to dig in the code.
                      I cut the snippet code to see step by step the execution time.
                      The first weakness was the getParentsIDs.
                      With 2400 docs in DB, the function was time out (superior to the 30s allowed by my hoster).

                      I’ve written a nex function to get the doc list differently from the $modx->documentMap; (as the previous function does)
                      Once done, this new function returned successfully the expected list.
                      After that, I tried to execute the whole snippet code but same result "maximum time ...."
                      I was unable to load the page.

                      I’ve found that ditto asked for every doc the TV output.
                      So I’ve reversed the logic (which was easy because of the quality of the existing code)
                      and queried the db for each TV with a where Clause docid IN (list returned by new function)

                      After this change the page was loading successfully smiley

                      I had to change some others functions such as getChildIDs (ditto uses a different logic according the params set in the call)

                      Hope that gives a beginning of explanation.

                      :-)



                        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l