Articles tagged 'rubygems'

  • Ruby performance: Using benchmarks and memory_profiler to chase performance degradations

    February 11, 2018

    While working on some of the performance improvements for version 1.0.0 of Rambling Trie late in 2016 and early in 2017, I upgraded from Ruby 2.3.3 to Ruby 2.4.0 imagining that the newer version would help me on my mission to make all operations execute a bit faster. To my surprise, I ran into a significant performance degradation after upgrading - specifically, there was a ~25% increase in the time it took to execute a script using a trie with a big-ish word dictionary. This intrigued me enough that I decided to take a closer look.

    Benchmarking with Ruby

    After some investigation with the help of Ruby’s own Benchmark, I realized that while most operations were a bit slower, the main problem was a lot more visible during intensive operations…

    Continue Reading →

  • Rambling Trie 1.0.0 released!

    January 23, 2017

    It’s been a while since I last wrote anything about Rambling Trie (or anything at all really), but I wanted to take the time to talk about all the changes and performance improvements that I’ve made to the gem lately and that culminated in the release of version 1.0.0.

    The changes worth highlighting are:

    NEW: Ability to dump and load tries from disk

    It takes a relatively long time to load all the words from a large dictionary into a new trie in memory. This becomes especially annoying when you have to do this full process every time you restart your application, even though you know that the trie is going to remain constant over time.

    To sort this out, you can now use the Rambling::Trie.load and Rambling::Trie.dump methods! Like this:

    Continue Reading →

  • Version 0.4.2 of the Rambling Trie has been released!

    July 28, 2012


    This post was originally published in the Rambling Labs Blog on July 28, 2012.


    The Rambling Trie has reached its 0.4.2 version. This one includes the before mentioned changes for the trie instance to behave as an Enumerable.

    This means that having this:

    trie = Rambling::Trie.create
    (%w(some words and other stuff)).each |word|
      trie << word
    end
    

    You can do something like this:

    trie.each do |word|
      puts "#{word} is included!"
    end
    

    As well as:

    trie.any? { |word| word.include? 'x' }
    trie.all? { |word| word.length > 0 }
    

    And any other method included in Ruby core’s Enumerable module. Isn’t that cool!?

    Enjoy!

    Continue Reading →

  • New homepage for Rambling Trie

    July 28, 2012


    This post was originally published in the Rambling Labs Blog on July 28, 2012.


    As done with the jQuery Rambling Slider previously on this week, and as I promised on that post as well, the Rambling Trie now has its own homepage on ramblinglabs.com! Here’s the link:

    Rambling Trie | A Ruby implementation of the Trie data structure

    It features installation and usage steps as well as a contributing page, and includes the badges from various cool GitHub services (more on that later). It also has a brand new logo, inspired on the trie data structure (and other tree data structures) concept.

    Go ahead and check it out!

    Still pending:

    • Examples page for jQuery Rambling Slider
    • Examples page for Rambling Trie
    • Examples page for Rambling Slider…

    Continue Reading →

  • The rambling-slider-rails v0.1.0 has been released!

    July 22, 2012


    This post was originally published in the Rambling Labs Blog on July 22, 2012.


    Version 0.1.0 of the rambling-slider-rails gem is here! And it includes a major bug fix.

    The rambling-slider-rails gem had an awful bug when running on production mode, causing the SASS to not be compiled. There were a couple of failed attempts before 0.1.0 trying to fix this. They were 0.0.2 and 0.0.3, which have both been yanked from the RubyGems repository.

    After fixing the issue and revising the file/directory structure, the version 0.1.0 has been pushed to RubyGems and should now be working correctly on both production and development modes.

    See Introducing rambling-slider-rails: Easily include the jQuery Rambling Slider on your rails app and the project…

    Continue Reading →

  • Rambling Trie 0.4.1 is out!

    July 21, 2012


    This post was originally published in the Rambling Labs Blog on July 21, 2012.


    Version 0.4.1 of the Rambling Trie is here. It has some minor performance improvements over previous versions, changes in file/directoy structure, as well as a new API entry point, other API methods and more documentation.

    You can now instance a new trie like this:

    trie = Rambling::Trie.create
    

    DEPRECATION WARNING

    The old API entry point Rambling::Trie.new is now marked as deprecated and will be removed soon. Use the new Rambling::Trie.create method.


    Also, you can add words to the trie using <<:

    trie << 'word'
    

    And check if a word is contained in the trie with include?:

    trie.include? 'word'
    

    You can see more documentation available on the project’s repository…

    Continue Reading →

  • Introducing rambling-slider-rails: Easily include the jQuery Rambling Slider on your rails app

    April 27, 2012


    This post was originally published in the Rambling Labs Blog on April 27, 2012.


    About three weeks ago, I had to use the jQuery Rambling Slider together with the Rails asset pipeline… It was a headache and a total mess… Having to change all the references to the images on the CSS file, as well as the themes was not as smooth as I would like that to be.

    So, I automated the process a bit locally and started to think how would be the easiest way to integrate the jQuery Rambling Slider into a Rails app. Then it hit me…

    Of course! How about building a gem that includes the necessary adjustments for the asset pipeline on Rails? That would we really cool and will save me from doing the same process over and over again for each new application…

    Continue Reading →

  • Rambling Trie 0.3.3 has been released!

    February 13, 2012


    This post was originally published in the Rambling Labs Blog on February 13, 2012.


    The new version of the rambling-trie gem is out! As I said on my previous post, the rambling-trie is an implementation of the Trie data structure in Ruby.

    Version 0.3.3 has several performance improvements, and I also added the code’s documentation via Yard. Also, since the previous version (0.3.2), the methods has_branch_for? and is_word? have been fixed for the compressed trie.

    For the uncompressed trie, the has_branch_for? and is_word? methods work very fast. The compressed trie’s is_word? method is as fast as it’s uncompressed counterpart, but the has_branch_for? is a bit slower.

    I’ve also added some benchmarking reports for each version of the rambling…

    Continue Reading →

  • Rambling Trie: A custom Trie data structure implementation in Ruby

    February 10, 2012


    This post was originally published in the Rambling Labs Blog on February 10, 2012.


    We’re proud to announce that our first gem is here!

    It’s called rambling-trie, and it’s an implementation of the Trie data structure. A Trie is an ordered tree data structure, and it is great for managing dictionaries and for word searching and matching.

    Now, to install the rambling-trie, you can either install it manually by running:

    gem install rambling-trie
    

    Or, you can add this line to the Gemfile of your application:

    gem 'rambling-trie'
    

    To create a new Trie you can do this:

    require 'rambling-trie'
    
    trie = Rambling::Trie.new
    

    And to add a new word to the Trie, you can call this:

    trie.add_branch_from 'word'
    

    Or to automatically load words from a file…

    Continue Reading →

  • Writing your blog posts in Markdown with Postmarkdown

    February 3, 2012


    This post was originally published in the Rambling Labs Blog on February 3, 2012.


    Another thing we added to our new site, uploaded back at the end of December, was the ability to write our blog posts in Markdown, which is a text-to-html tool that allows you to write formatted text without actually having to write all the corresponding HTML. Markdown is used for the project wiki pages on GitHub, and can also be used for the project’s readme file.

    Most of the time, I don’t like that HTML gets autogenerated for me, since I usually don’t get the results I want. We used to have the site (which was really the blog only) in WordPress, and I never used the autogenerated HTML. In fact, it was quite the opposite: I wrote every blog post in plain…

    Continue Reading →