Welcome Guest, Not a member yet? Register   Sign In
How badly do we want ORM?
#1

[eluser]Unknown[/eluser]
Just how badly is ORM wanted by the CI community? I have been working on a very simple helper that would "bolt on" ORM. It seems very promising, although it's a long way to alpha.

However, it does appear that the overhead of creating objects out of rows in an array is significant. I'm using lazy instantiation to avoid objectifying any particular result until directly called, but this still adds quite a bit of overhead. My initial tests show a slightly exponential increase in load times as the number of records increases. At ten records, the difference between standard array iteration and iteration with instantiation is not noticeable- in fact, sometimes with ORM proved to be faster (almost certainly due to other processes going on in the environment). At 100 records, the difference is in hundredths of a second. At 10,000 results, the difference is just under a 100% increase in load time.

The alternative is to have a function wrapper that accepts a row as input and manually generates an object. The disadvantage is that this would not be able to introspect if the result already exists, and would not be able to have a universal save() method without an extra parameter being passed to the wrapper function. However, this would allow native speeds and only instantiate where specifically needed.

After having several people look over the code (which is very bare bones at this point- it's simply a wrapper class) and trying a few techniques and methods to iterate (tail recursion, for and foreach iteration, etc.), the trend in load times seems to equal out across the board. I think the problem is simply the overhead of PHP objects (as they were sort of "bolted on" as well).

So, do you guys think it's worth continuing and creating a finished product that can be added into a project? For your uses of CI, is that an acceptable overhead?


Messages In This Thread
How badly do we want ORM? - by El Forum - 07-11-2007, 12:32 PM
How badly do we want ORM? - by El Forum - 07-11-2007, 12:51 PM
How badly do we want ORM? - by El Forum - 07-11-2007, 02:47 PM
How badly do we want ORM? - by El Forum - 07-12-2007, 11:42 AM
How badly do we want ORM? - by El Forum - 07-15-2007, 09:12 AM
How badly do we want ORM? - by El Forum - 07-17-2007, 04:04 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 06:32 AM
How badly do we want ORM? - by El Forum - 08-15-2007, 08:51 AM
How badly do we want ORM? - by El Forum - 08-15-2007, 03:18 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 03:26 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 04:08 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 04:34 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 05:02 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 06:08 PM
How badly do we want ORM? - by El Forum - 08-15-2007, 06:52 PM
How badly do we want ORM? - by El Forum - 08-18-2007, 11:09 AM
How badly do we want ORM? - by El Forum - 08-22-2007, 04:26 PM
How badly do we want ORM? - by El Forum - 08-22-2007, 04:54 PM
How badly do we want ORM? - by El Forum - 08-23-2007, 03:42 PM
How badly do we want ORM? - by El Forum - 01-20-2008, 04:32 PM
How badly do we want ORM? - by El Forum - 01-23-2008, 03:10 AM
How badly do we want ORM? - by El Forum - 01-29-2008, 12:19 AM
How badly do we want ORM? - by El Forum - 01-29-2008, 02:18 AM
How badly do we want ORM? - by El Forum - 08-18-2008, 01:30 PM
How badly do we want ORM? - by El Forum - 08-19-2008, 05:40 AM
How badly do we want ORM? - by El Forum - 08-19-2008, 09:40 AM
How badly do we want ORM? - by El Forum - 08-19-2008, 11:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB