This project is archived and is in readonly mode.

#592 ✓invalid
Lourens Naudé

Avoid excessive AST traversal for Routing

Reported by Lourens Naudé | July 10th, 2008 @ 03:10 PM | in 2.x

Comments and changes to this ticket

  • Mike Burns

    Mike Burns July 10th, 2008 @ 03:55 PM

    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]

  • Lourens Naudé

    Lourens Naudé July 10th, 2008 @ 04:13 PM

    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.

  • Pratik

    Pratik July 11th, 2008 @ 05:57 PM

    • State changed from “new” to “invalid”

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

    Thanks.

  • Evan

    Evan July 11th, 2008 @ 05:58 PM

    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.

  • Lourens Naudé

    Lourens Naudé July 11th, 2008 @ 07:22 PM

    Thanks for time spent in reviewing this.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages