Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Avoid excessive AST traversal for Routing

#592

Reported by Lourens Naudé · July 10th, 2008 @ 03:10 PM

State: invalid
Milestone: 2.x
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Mike Burns
    Mike Burns

    How much of a speedup does this gain?

    I just ran some self.z= vs. @z= micro-benchmarks and had to run a large number of these before I saw an obvious difference.

    ruby 1.8.6 (2007-09-24 patchlevel 111) [amd64-freebsd7]

    July 10th, 2008 @ 03:55 PM

  2. Lourens Naudé
    Lourens Naudé

    Mike,

    I'll attach benchmarks in a bit.

    We've got 5 namespaces, each with 10 to 15 odd controllers.

    Each map.resources spawns 14 routes ( excluding custom via :collection or :member ) by default.

    class Bar

    attr_accessor :foo

    def method_a

    self.foo #method lookup

    end

    def method_b

    foo #method lookup

    end

    def method_c

    @foo #no method lookup

    end

    end

    Routing, especially with a large routes.rb file, features prominently in profiler output as well as bleakhouse dumps.

    Bottom line being you'd notice no difference with a limited number of routes.

    July 10th, 2008 @ 04:13 PM

  3. Pratik
    Pratik
    • State changed from new to invalid

    -1 on this. If you insists, please do disuss in rails core mailing list.

    Thanks.

    July 11th, 2008 @ 05:57 PM

  4. Evan
    Evan

    BleakHouse has nothing to do with runtime performance.

    I'm them having trouble imagining that is change makes a difference on real apps, and it makes the code harder to understand and introspect.

    July 11th, 2008 @ 05:58 PM

  5. Lourens Naudé
    Lourens Naudé

    Thanks for time spent in reviewing this.

    July 11th, 2008 @ 07:22 PM