> We've actually discussed this before in IRC.  In fact I think this
> approach is totally complementary to how DataMapper works.  We attempt
> to be lazy in almost every other way, but this is one area we are
> lacking.

Interesting.
The slim attributes style is definitely a very "lazy" one.
As I understand it [correct me if I'm wrong] DM creates "real ruby
objects" for everything, and AR currently creates string hashes for
everything [and lazily evaluates].  Therefore I'd put AR and DM at
about the same speed [or did I read somewhere once that DM was
actually slightly slower--blame it on the conversion?]

So like you said, seems like there's a potential in there to do for DM
what slim does for AR--lazily evaluate the [strings, ints, etc.]
instead of doing them all up front.

I know in my own tests slim is a good deal faster than AR's all_hashes
method.

The kicker is DM's sql -> ruby conversion is all in C, so this type of
lazy evaluating should be done in C, is that correct?

The biggest speedups are when you don't need access to all columns in
a row.  If you do then I suppose it might slow you down a teensy
bit.

As someone else mentioned, the "bottleneck" of DM may well not be
right here, but...at least something like this would generate a whole
lot less garbage.

Thoughts?

I might take a stab at it sometime [esp. since we already have the
slim code to work from].

I suppose since the variables are stored as ivars we should create a
new class which calls a proxy object to "lazily give us" the real
values?
a la

class DM_Member
instead of @column_name
def column_name
  @column_instance || = proxy.get
end
end



Thanks.
-=R.


>
> Technically we should still be able to exceed theSlimAttributes
> performance with DO because it doesn't create intermediary String
> objects to hold the return values -- when accessed they could be
> typecasted directly into an instance of whatever ruby primitive
> corresponds to the property, just like now.
>
> I would love to see someone explore this with DataObjects and
> DataMapper.  I don't know what, if any, changes would be required but
> if someone has the C knowledge and the motivation they should go for
> it.  According to theSlimAttributeshome page they are seeing as
> much as a 50% speed increase.
>
> Dan
> (dkubb)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to