I’m probably just being over-obsessive about memory usage and all that anyway.
I think this is an easy mistake to make, that most devs make when switching to an ORM. My general rule is, get the code working (cleanly) first, then worry about optimizing. You don’t want to spend a lot of time to optimize something, and then change (or delete) the method later!
I think I’ve spent more time on messing with ORM than doing actual work :D
Aaaaand that’s how I ended up posting nearly 300 times supporting DataMapper, and writing several important enhancements to the core… 😊
One thing I like about DataMapper (and DMZ) is that it generates very clean queries, because it is written on top of ActiveRecord. If at all possible, try to avoid hand writing any SQL code. If you do, you’ll end up with a mess to manage later on, especially if you make any model name changes.
Also, the requirement for joining tables, it’s not always needed. I guess a bit of a restriction there.
(I think) This is what I was referring to above, about DMZ and supporting in-table foreign keys. DataMapper requires a dedicated table for every join, even $has_one joins. DMZ supports having a field called <relatedfield>_id on a model’s table. This can lead to significant table reduction (in my case, I removed over 20 tables).
DMZ is a drop-in replacement for DataMapper, fully backward compatible. The only reason I “forked” it is because stensi has (temporarily, hopefully) stopped updating DataMapper, and there were features that needed to be written. The extra features, sadly, are not nearly as well documented.