[ANN] FastRI 0.1.1 (fast+smart ri docs searching): configurable search strategies

Discussion in 'Ruby' started by Mauricio Fernandez, Nov 10, 2006.

  1. FastRI is an alternative to the ri command-line tool. It is *much* faster, and
    also allows you to offer RI lookup services over DRb. FastRI is smarter than
    ri, and can find classes anywhere in the hierarchy without specifying the
    "full path". Its RubyGems support is better than ri's, and it knows which gem
    a method/class definition came from.

    Getting it
    ==========
    Additional information, tarballs... at
    http://eigenclass.org/hiki.rb?fastri

    FastRI can be installed with RubyGems:
    gem install fastri
    (if you get an old version/a 404 error, please allow some time after the
    release until the package propagates to the RubyForge mirrors). Please read
    below for an important note regarding the RubyGems packages.

    Release information and change summary:
    http://eigenclass.org/hiki.rb?fastri 0.1.1

    Usage
    =====
    There are two parts to FastRI:
    * the server: fastri-server
    * the client: fri

    FastRI uses a Rinda Ring to allow servers to be discovered automatically
    without needing to indicate the DRb URIs manually. It can work across
    machines if you make sure the ring server is bound to the correct interface,
    and the ACL permissions are correct.

    Examples
    ========
    $ fastri-server (creates the index on the first run, blocks)

    Later, (times measured with a cold cache):
    $ time ruby bin/fri -f plain Array#fetch
    ------------------------------------------------------------ Array#fetch
    array.fetch(index) -> obj
    [...]
    real 0m0.287s (real 0m0.127s with a hot cache)
    user 0m0.048s
    sys 0m0.008s

    Compare to:
    $ time ri -T -f plain Array#fetch
    ------------------------------------------------------------ Array#fetch
    [...]
    real 0m10.136s (real ~ 1.5s with a hot cache)
    user 0m1.140s
    sys 0m0.464s

    This illustrates FastRI's ability to locate classes deep in the class
    hierarchy:

    $ fri Base
    ------------------------------------------------------ Multiple choices:

    ActionMailer::Base, ActionView::Base, ActionWebService::API::Base,
    ActionWebService::Base, ActionWebService::Client::Base,
    ActiveRecord::Base, MapReduce::ActiveRecord::Base,
    RSS::Maker::Base, Scruffy::Components::Base,
    Scruffy::Formatters::Base, Scruffy::Layers::Base,
    Scruffy::Renderers::Base, Scruffy::Themes::Base

    $ fri Themes::Base
    ------------------------------------------- Class: Scruffy::Themes::Base
    Scruffy::Themes::Base
    Author: Brasten Sager

    Date: August 14th, 2006

    Compare to
    $ ri Themes::Base .... several seconds later ...
    Nothing known about Themes::Base

    A small note about RubyGems + FastRI.
    =====================================
    RubyGems adds a noticeable overhead to fri, making it run slower than if you
    installed it directly from the tarball with setup.rb.

    Compare the execution time when installed with RubyGems:
    $ time fri -f plain String > /dev/null

    real 0m0.385s
    user 0m0.244s
    sys 0m0.036s

    to the time fri actually takes to run, without the overhead introduced by
    RubyGems:
    $ time ruby bin/fri -f plain String > /dev/null

    real 0m0.088s
    user 0m0.040s
    sys 0m0.008s

    If you care about those extra 300ms (and there are situations where they will
    matter, e.g. when using fri for method completion), get FastRI from the
    tarballs.

    License
    =======
    FastRI is licensed under the same terms as Ruby. See LICENSE.

    Feedback
    ========
    Bug reports, patches, comments... are appreciated.
    You can contact the author via <>. Please add "fastri" to the
    subject in order to bypass the spam filters.


    --
    Mauricio Fernandez - http://eigenclass.org - singular Ruby
     
    Mauricio Fernandez, Nov 10, 2006
    #1
    1. Advertising

  2. Re: [ANN] FastRI 0.1.1 (fast+smart ri docs searching): configurablesearch strategies

    Mauricio Fernandez wrote:
    > FastRI is an alternative to the ri command-line tool. It is *much* faster, and
    > also allows you to offer RI lookup services over DRb. FastRI is smarter than
    > ri, and can find classes anywhere in the hierarchy without specifying the
    > "full path". Its RubyGems support is better than ri's, and it knows which gem
    > a method/class definition came from.
    >


    Excellent work. Works perfectly on my osx box.
    Though, standard ri goes in to 'less' mode, I kinda got used to that.
    Could it be possible that with some ~/.fastri configuration file I
    could control if I want to pass it though 'less -R' ? (I'm assuming
    not everyone wants it as a default.)

    Now to alias ri to fri and somehow make it fallback if the server
    isn't running =)

    --
    Mikko Lehtonen
     
    Mikko Lehtonen, Nov 10, 2006
    #2
    1. Advertising

  3. On Fri, Nov 10, 2006 at 09:51:48PM +0900, Mikko Lehtonen wrote:
    > Mauricio Fernandez wrote:
    > >FastRI is an alternative to the ri command-line tool. It is *much* faster,
    > >and also allows you to offer RI lookup services over DRb. FastRI is smarter
    > >than ri, and can find classes anywhere in the hierarchy without specifying
    > >the "full path". Its RubyGems support is better than ri's, and it knows
    > >which gem a method/class definition came from.

    >
    > Excellent work. Works perfectly on my osx box.
    > Though, standard ri goes in to 'less' mode, I kinda got used to that.
    > Could it be possible that with some ~/.fastri configuration file I
    > could control if I want to pass it though 'less -R' ? (I'm assuming
    > not everyone wants it as a default.)


    Sure, I'll implement it; it will probably be in 0.2.0. I always hated that
    about ri though, so I think it'll default to pager-less mode ;-)

    > Now to alias ri to fri and somehow make it fallback if the server
    > isn't running =)


    Jonas Pfenniger has done some work towards making fri launch the server (which
    would run as a daemon). We're not there yet, but I've created a branch for
    that at http://eigenclass.org/repos/fastri/branch-daemon/ (hint: help appreciated :)

    The bin/fastri-server you'll find there honors a -d option to run in the
    background. This works already, using the 'daemons' gem, but it'd be best if
    we could get rid of that dependency (a reasonable #daemonize should take a
    dozen lines). bin/fri already tries to start the server when it cannot be
    found, but this is not working yet (did I say that patches are appreciated? :).
    Another pending issue is win32 compatibility: would it be possible to write
    something equivalent to #daemonize without fork()?

    --
    Mauricio Fernandez - http://eigenclass.org - singular Ruby
     
    Mauricio Fernandez, Nov 10, 2006
    #3
  4. On Fri, Nov 10, 2006 at 09:51:48PM +0900, Mikko Lehtonen wrote:
    > Excellent work. Works perfectly on my osx box.

    =====
    > Now to alias ri to fri and somehow make it fallback if the server
    > isn't running =)


    I forgot to point you to
    http://kakutani.com/20061108.html
    which shows how to run fastri-server automatically when you login on OSX.

    --
    Mauricio Fernandez - http://eigenclass.org - singular Ruby
     
    Mauricio Fernandez, Nov 10, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mauricio Fernandez
    Replies:
    24
    Views:
    386
    Gabriele Marrone
    Nov 15, 2006
  2. Mauricio Fernandez
    Replies:
    7
    Views:
    130
    Thomas Nitsche
    Nov 21, 2006
  3. Mauricio Fernandez
    Replies:
    5
    Views:
    115
    Robert Feldt
    Nov 23, 2006
  4. Mauricio Fernandez
    Replies:
    6
    Views:
    148
    Mauricio Fernandez
    Jan 31, 2007
  5. synergism
    Replies:
    0
    Views:
    101
    synergism
    Mar 4, 2008
Loading...

Share This Page