![]() |
A possible code rewrite for the Loader load library method - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: A possible code rewrite for the Loader load library method (/showthread.php?tid=38691) |
A possible code rewrite for the Loader load library method - El Forum - 02-18-2011 [eluser]Jaketoolson[/eluser] You need to fork this @ github so I can better track changes... do you mind doing so? I liked the commentary. A possible code rewrite for the Loader load library method - El Forum - 02-18-2011 [eluser]Basketcasesoftware[/eluser] Sure. As soon as I take the time to learn how to do the fork. ![]() A possible code rewrite for the Loader load library method - El Forum - 02-18-2011 [eluser]Basketcasesoftware[/eluser] I'm not using GitHub but BitBucket instead which is what CodeIgniter uses. I've done a fork off of the CI Reactor project there. Already had an account anyways after I submitted a document bug for the User Guide. Downloaded and installed Tortoise and getting going. I'll hopefully have the fork finished by the end of this weekend. A possible code rewrite for the Loader load library method - El Forum - 02-19-2011 [eluser]InsiteFX[/eluser] Try to replace the while loops those are the bottle neck! InsiteFX A possible code rewrite for the Loader load library method - El Forum - 02-19-2011 [eluser]Basketcasesoftware[/eluser] [quote author="InsiteFX" date="1298117066"]Try to replace the while loops those are the bottle neck! InsiteFX[/quote] Ok. Thanks for that input. I really didn't care for them either. Any specific suggestions? Right now I'm partial to foreach loops but I'm looking for a faster alternative. The Map_Array function is nice, but there was too much overhead setting up the arguments in my previous version of this. A possible code rewrite for the Loader load library method - El Forum - 02-19-2011 [eluser]Basketcasesoftware[/eluser] Here's my alternative (this is just one instance of this kind of looping) Code: // First break the set of names for the library objects into subsets that map one-to- Oh, the code the above replaces went like this: Code: // Make sure we start with the beginning of the library array for the first loop. A possible code rewrite for the Loader load library method - El Forum - 02-19-2011 [eluser]Basketcasesoftware[/eluser] I'm not thrilled with my previous optimization and I realized a potential feature bug shortly after I made the posting. Just now have the time to make the update and corrections. Code: // First pad the object_name array out with NULLs if it is smaller than the array of library objects to make it the same size. A possible code rewrite for the Loader load library method - El Forum - 02-21-2011 [eluser]Basketcasesoftware[/eluser] Ok. I have a Reactor fork over at BitBucket. I guess this is the correct URL: https://bitbucket.org/Basketcasesoftware/codeigniter-reactor/overview A possible code rewrite for the Loader load library method - El Forum - 02-21-2011 [eluser]InsiteFX[/eluser] Hey Basketcase, I was up most of the night and did some researching on the while loops etc. It doe's not make that much of a speed difference so don't worry about it. For loops can slow you down but just make sure that that the count variable is initalizied before it it used in the for loop big speed difference! I bet you are wondering how I got the software box in the basket LOL! InsiteFX A possible code rewrite for the Loader load library method - El Forum - 02-21-2011 [eluser]Basketcasesoftware[/eluser] That question did occur to me. ![]() And I went ahead and did those rewrites anyways. I think I got the speed on par with the original method. I probably get most of my overhead from all the comments. :-P Are you going from my code fork? I did other optimizations with regards to the conditionals. Got rid of all the else statements and minimized the function calls for the conditionals. I need to find a decent way to automate the profiling of the code. Overall, what did you think of the effort? |