Martin Tithonium (tithonium) wrote,
Martin Tithonium
tithonium

OMFG

I'm using Hobo for taskomat. Even running in production mode, loading my entire task list has been.. horrifyingly slow. Looking at the logs, I noticed, among other things, that it seemed to be loading the user record at least once for /every single task/. Ok, that's weird. The only place I find that it loads the user, it's caching it. So.. wtf?

Digging through the code, I find that, whenever I display an editor field, it checks to see if the current user can edit that field. the check to see if you can edit, eventually, deep down, /duplicates the object and tries to change the field on the duplicate/. Ok, that makes a certain amount of sense, sure. If you try to set the value and it throws an error, obviously you aren't allowed to edit.

Except.. it duplicates all the relationships that the object has... with other objects... like.. the user, that every single task is owned by. And because of the type of relationship, it loads the value. From the database. Every time.

I wrote my own editor functions. Which don't check edit permissions, since if you can see the entry, I already know you own it and can edit.

Before, under the best of circumstances - all classes loaded and cached, all dryml loaded, compiled, and cached, fastcgi mode - it took 45 seconds or more to load my task list.

Now, newly restarted, nothing loaded, nothing cached... 7 seconds. After caching... 3.

I may go back and rip out my dependancies on hobo, either copy back in the useful bits or roll my own, and see if I can get that down below 1s.



Yes, yes, hobo is pre-release, alpha, in development, yeah yeah. That doesn't mean I can't be dismayed at such poor design. <edit> called can_edit? before calling <editor>, which calls can_edit? before calling the type editor, some of which call can_edit? before doing anything. At least that stream only causes /one/ unnecessary db hit.
Tags: programmers suck
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment