Skip to content
Faker refactored. Cleaner. Faster.
Ruby Shell
Find file
Pull request Compare This branch is 5 commits ahead, 680 commits behind ffaker:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Fast Faker == Faker refactored, cleaner and faster.


A port of Perl's Data::Faker library that generates fake data.


require 'ffaker' => "Christophe Bartell" => "李小飞" (motified by qichunren) => ""

Ffaker / Faker

The only difference between faker and ffaker is that you need to

gem install ffaker

and then

require 'ffaker'

instead of “faker” with only one f.

The API is pretty much the same as before.

Fork it/ping me if you feel like adding more goodies to it.

Faster? does it really matter ?

While it may seem like the speed of good'ol faker was not such a big deal, I really disliked the previous code base.

Speed came as a result of having better code in place. Getting a few more cycles here and there was not bad, specially since I had fun while doing the refactoring.

Here are some benchmarks (yeah everybody love benchmarks!)

$ cat scripts/benchmark.rb

# ...
N = 10_000 do |rep|"generating #{ N } names") do
    N.times do
  • ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2009.10

                    user     system      total        real
    Faker       9.240000   0.020000   9.260000 (  9.297381)
    Fast Faker  0.060000   0.000000   0.060000 (  0.109047)
  • ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]

                    user     system      total        real
    Faker      74.980000   0.110000  75.090000 ( 75.881142)
    Fast Faker  0.050000   0.000000   0.050000 (  0.052292)

DISCLAIMER: I have no idea why I'm getting such bad numbers for traditional faker on 1.9, but I'm not making this up! Try it in your own machine, your mileage may vary.


  • Even though the API is pretty simple, better rdoc documentation would not hurt.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.



Copyright © 2010 Emmanuel Oga. See LICENSE for details. Copyright © 2007 Benjamin Curtis

Something went wrong with that request. Please try again.