Ripta,

thanks for the great suggestions.

On Tue, Jul 27, 2010 at 1:53 PM, Ripta Pasay <[email protected]> wrote:

> I'm not sure how much of a speed-up you'll get by foregoing DateTime
> fields. I think most of the slow down happens in the overhead of
> instantiating complex model objects for every single row returned.
> That said, you *could* declare those DateTime properties as type
> String, and DM will not bother to cast the property into DateTime
> objects; it wouldn't be safe to write, but it should be okay for read-
> only.
>
>
I think you are quite correct - it's not the just the cast of the
datetime, but the model object itself - trying your string suggestion
only doubled the speed, 3300 => 6100 records/sec

Alternatively, you could also query the datastore directly, e.g.:
>
>    DataMapper.repository.adapter.select("SELECT id, name,
> initial_timestamp FROM  package_records WHERE initial_timestamp >= ?",
> 2.months.ago)
>
> The #select call will return an Array of Structs, and
> initial_timestamp should be a String.
>
>
Well,  that too only gives a doubling, surprisingly.  The
DateTime cast is still done in that case, BTW.


Just curious though: if a straight MySQL call completes the process in
> an order of magnitude faster and if performance is important on this
> specific case, why not skip DM entirely?
>
>
Oh,  I'm all for it - implemented a TableClass (array of records
model) on top of MySQL and Postgres,  works well for this
app (I'd much rather use domain-based models like DM for
other apps, but this one doesn't need such sophistication)

I'm afraid this is one of those layer seven issues.

Thanks for the suggestions,  I'm a real DM noob.

-Randy Fischer


>
> On Jul 27, 2:14 am, Randy Fischer <[email protected]> wrote:
> > Networthy,
> >
> > I have an application that's running too slow using DM
> > and am wondering what I can do to speed it up.  Originally I
> > was using straight MySQL or Postgres, processing 15,000
> > records in a few seconds to produce an XML file.
> >
> > Using a naive datamapper implementation, it's taking
> > several minutes....
>

-- 
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