Performance of S.?

37 views
Skip to first unread message

Jeppe Nejsum Madsen

unread,
Mar 1, 2012, 10:22:39 AM3/1/12
to lif...@googlegroups.com
Hi

Just spent some time tracking down a slow request and finally found
out it's caused by S.?

Changing

protected def _valueToDisplayString(v:ENUM#Value) =
S.?(enum.toString+"."+v.toString)

to

private object nameCache extends RequestMemoize[String,String]
protected def _valueToDisplayString(v:ENUM#Value) = {
val key = enum.toString+"."+v.toString
nameCache.get(key, S.?(key))
}

results in a drop in response time from 2.5s to about 250ms.

Now, this is probably an unusual case (rendering 3500 rows each with 4
lookups), but is there any reason _not_ to cache the result of a
resource (key,locale) lookup when running in production?

/Jeppe

David Pollak

unread,
Mar 1, 2012, 12:13:37 PM3/1/12
to lif...@googlegroups.com
Looks like a good change to me.  Should we do the same for S.??


/Jeppe

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net


Viktor Hedefalk

unread,
Mar 1, 2012, 12:40:43 PM3/1/12
to lif...@googlegroups.com
Sweet!

Jeppe Nejsum Madsen

unread,
Mar 1, 2012, 12:49:12 PM3/1/12
to lif...@googlegroups.com
How about deprecating ?? and just add the core resource bundle at the
end of the ? bundles?

This would provide a way to selectively override core properties
without having to maintain the whole file....

/Jeppe

On Thu, Mar 1, 2012 at 6:13 PM, David Pollak
<feeder.of...@gmail.com> wrote:

David Pollak

unread,
Mar 1, 2012, 12:55:31 PM3/1/12
to lif...@googlegroups.com
On Thu, Mar 1, 2012 at 9:49 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:
How about deprecating ?? and just add the core resource bundle at the
end of the ? bundles?

This would provide a way to selectively override core properties
without having to maintain the whole file....

+1
Reply all
Reply to author
Forward
0 new messages