# Speeding Up

**URL:** <https://www.ruby-forum.com/t/speeding-up/138952>\
**Category:** Rails\
**Created:** [May 29, 2008, 10:26am UTC](https://www.ruby-forum.com/t/speeding-up/138952 "2008-05-29T10:26:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NKNKNK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5ac83/32.png) [@NKNKNK](https://www.ruby-forum.com/u/NKNKNK)\
**Post date:** [May 29, 2008, 10:26am UTC](https://www.ruby-forum.com/t/speeding-up/138952/1 "2008-05-29T10:26:24Z")

</div>

Hey all,

I’ve been profiling my app and noticed that Date.\_parse is eating up  
a lot of time in some of my requests.

I’m attempting to pull the date from MySQL w/o ActiveRecord’s  
typecasting, but just can’t seem to be able to do it. I tried  
\<attr\_name\>\_before\_type\_casting &  
read\_attribute\_before\_type\_casting(attr\_name) and all I get back is a  
Date object. What I want to get back is a string rep of the date as  
the db stored it.

Any clues as to why typecasting is happening anyway?

I’m using rails 2.0.2 & MySQL 5.0.51a-3ubuntu5.

Thanks.

-Nash

---

<div class="post-metadata">

**Author:** ![NKNKNK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5ac83/32.png) [@NKNKNK](https://www.ruby-forum.com/u/NKNKNK)\
**Post date:** [May 29, 2008, 10:35am UTC](https://www.ruby-forum.com/t/speeding-up/138952/2 "2008-05-29T10:35:52Z")

</div>

On 28 May 2008, at 22:38, NK wrote:

> Date object. What I want to get back is a string rep of the date as  
> the db stored it.
> 
> Any clues as to why typecasting is happening anyway?

because usually a date object is more useful (rails 2.1 has some code  
to make that a lot faster).  
Can you use the attributes\_before\_type\_cast hash ?

Fred
