How are auto tags for pages invoked in absence of a template?

3 views
Skip to first unread message

Paul Howson

unread,
Jan 8, 2009, 7:05:44 PM1/8/09
to Hobo Users
Normally Rails expects a view template for each controller/view
combination, and complains if it's missing.

With a new Hobo app, most of the view template folders are empty.

Instead Hobo generates tag definitions to suit the defined hobo models
and puts these in the folder taglibs/auto/rapid.

How are these auto-generated tags called in the absence of a view
template?

And what triggers the generation or re-generation of these auto-
generated tags?

Paul Howson

Scott Bronson

unread,
Jan 10, 2009, 1:38:35 PM1/10/09
to hobo...@googlegroups.com
On Thu, Jan 8, 2009 at 4:05 PM, Paul Howson <pa...@tdgq.com.au> wrote:

Normally Rails expects a view template for each controller/view
combination, and complains if it's missing.

With a new Hobo app, most of the view template folders are empty.

Instead Hobo generates tag definitions to suit the defined hobo models
and puts these in the folder taglibs/auto/rapid.

How are these auto-generated tags called in the absence of a view
template?
 
application.dryml includes them just as it would any other taglib:

<include src="taglibs/auto/rapid/cards"/>
<include src="taglibs/auto/rapid/pages"/>
<include src="taglibs/auto/rapid/forms"/>


And what triggers the generation or re-generation of these auto-
generated tags?

They seem to be regenerated before each request in dev and once when your app starts up in production.  I haven't actually read the code so I might be wrong here.

I guess this contributes to how slow the dev environment is becoming...  I really do like not having to bounce my app all the time but sometimes it takes 3-4 seconds to handle a request!  Makes it fairly painful to navigate around my app.

I guess this is good -- encourages me to write more tests.  :)


Paul Howson

unread,
Jan 10, 2009, 3:16:36 PM1/10/09
to Hobo Users
You are right that Hobo is very slow in development. Your figure of
3-4 seconds per request sounds about right (and that's on a recent
iMac). I've been wondering where all the time goes since the server
log says that the database queries typically take only about 25ms and
the view code typically takes about 500ms (way too long). So what's
taking up the other 3 seconds?

I'm hoping these kinds of details will be addressed or explained at
some stage.

Paul

solars

unread,
Jan 10, 2009, 3:22:29 PM1/10/09
to hobo...@googlegroups.com
On Sat, Jan 10, 2009 at 12:16:36PM -0800, Paul Howson wrote:
> You are right that Hobo is very slow in development. Your figure of
> 3-4 seconds per request sounds about right (and that's on a recent
> iMac). I've been wondering where all the time goes since the server
> log says that the database queries typically take only about 25ms and
> the view code typically takes about 500ms (way too long). So what's
> taking up the other 3 seconds?

as mentioned before, the auto-generation of taglibs takes place and
uses that time

James Garlick

unread,
Jan 10, 2009, 3:43:10 PM1/10/09
to hobo...@googlegroups.com

On 10 Jan 2009, at 18:38, Scott Bronson wrote:
>
> They seem to be regenerated before each request in dev and once when
> your app starts up in production. I haven't actually read the code
> so I might be wrong here.
>
> I guess this contributes to how slow the dev environment is
> becoming... I really do like not having to bounce my app all the
> time but sometimes it takes 3-4 seconds to handle a request! Makes
> it fairly painful to navigate around my app.
>

That's right, but you can turn off the dev mode behaviour by doing:

Hobo::ModelRouter.reload_routes_on_every_request = false

This will stop both the routes and the auto taglibs being regenerated
on every request. I personally prefer this as it is much faster but
you have to remember to restart the app when you change the routes or
change something that would affect the generated taglibs.

Scott Bronson

unread,
Jan 10, 2009, 5:50:28 PM1/10/09
to hobo...@googlegroups.com
That's in config/initializers/hobo.rb. It appears to cut average time
for requests from 4sec to 2.5sec or so.

That's quite a bit better but still pretty slow. Ah well, I can live
with it. Thanks!

Paul Howson

unread,
Jan 11, 2009, 2:14:30 PM1/11/09
to Hobo Users
Well I tried switching over to the production environment and that
made things very zippy - e.g. 200ms ± 100ms per response. That's
reassuring.

Tom Locke

unread,
Jan 12, 2009, 5:08:28 AM1/12/09
to hobo...@googlegroups.com
> That's in config/initializers/hobo.rb. It appears to cut average time
> for requests from 4sec to 2.5sec or so.

2.5 seconds per request with that reloading stuff turned off sounds
waaaay too slow. Do you have a lot of models in your app? Even if you
do, the idea is that they don't all get reloaded if that setting is
turned off. It sounds like something is still reloading the models.
I'll have to investigate that.

DRYML rendering is also slower in dev mode.

There are many ideas in the pipeline that can make Hobo really a lot
faster. I'd like Hobo to be *faster* than plain Rails one day, and I
think that's possible (Hobo being higher level than Rails, there could
be opportunities for automatic caching), but as always it has to wait
in line with all the other issues.

Tom

Reply all
Reply to author
Forward
0 new messages