I’ve been working on building a compacting garbage collector in Ruby for a while now, and one of the biggest hurdles for implementing a compacting GC is updating references. For example, if Object A points to Object B, but the compacting GC moves Object B, how do we make sure that Object A points to the new location? Solving this problem has been fairly straight forward for most objects. Ruby’s ga
In a previous post, I wrote a bit about how Ruby objects are laid out in memory. Today we’ll use that information to write a program that will allow us to take a Ruby heap dump and visualize the layout and fragmentation of that heap. Ruby Object Layout Recap Just as a recap, Ruby objects are fixed width. That is, every Ruby object is the same size: 40 bytes. Objects are not really allocated with m
TL;DR: Inheriting from Hash will bite you. ¯\_(ツ)_/¯ This is Yet Another Post about preferring composition over inheritance, but I will try to drive it home with Real World Examples™. I’m not saying “don’t use inheritance”, I am saying “use inheritance conservatively, and when it is appropriate” (I know it’s not very controversial). I think I can confidently say “don’t inherit from String, Hash, o
TL;DR: AdequateRecord is a set of patches that adds cache stuff to make ActiveRecord 2x faster I’ve been working on speeding up Active Record, and I’d like to share what I’ve been working on! First, here is a graph: This graph shows the number of times you can call Model.find(id) and Model.find_by_name(name) per second on each stable branch of Rails. Since it is “iterations per second”, a higher v
TL;DR Rails 4.0 will allow you to stream arbitrary data at arbitrary intervals with Live Streaming. HAPPY MONDAY EVERYONE! Besides enabling multi-threading by default, one of the things I really wanted for Rails 4.0 is the ability to stream data to the client. I want the ability to treat the response object as an I/O object, and have the data I write immediately available to the client. Essentiall
Let’s do something fun! In this post we’ll take a photo using your webcam in Ruby. NOTE: This only works on OS X I haven’t tried making it work on other operating systems. Not that I don’t like other operating systems, I just haven’t made it work. :-) Installing the Gem We’ll use the av_capture gem. It wraps the AVCapture framework on OS X. To install it, just do: $ gem install av_capture Using th
I posted a benchmark on twitter about comparing a DateTime with a string. This is a short blurrrggghhh post about the benchmark and why there is such a performance discrepancy. Here is the benchmark: require 'benchmark/ips' require 'active_support/all' if ENV['AS'] require 'date' now = DateTime.now Benchmark.ips do |x| x.report("lhs") { now == "foo" } x.report("rhs") { "foo" == now } end First we’
YAML seems to be getting a bad rap lately, and I’m not surprised. YAML was used as the attack vector to execute arbitrary code in a Rails process and was even used to steal secrets from rubygems.org. Let’s try to dissect the attack vector used, and see how YAML fits in to the picture. The Metasploit Exploit First lets cover the most widely known vector. We (the Rails Security Team) have had report
omg…. OMG…. ZOMG!!!!! HAPPY TUESDAY TO EVERYONE IN THE WORLD!!!! Alright, now that the formalities are out of the way, LET’S GET DOWN TO BUSINESS! Some of you may or may not know, I joined the Ruby core team in October 2009. I am very proud to be a member of ruby-core. However, I have noticed that the Ruby core team does not have an awesome website like the Rails core team. To rectify this situati
Every year Japanese Rubyists participate in what is called the “Ruby Advent Calendar”. What is the Ruby Advent Calendar? Each day leading up to December 25th, one person posts an article to their blog and adds a link to their blog on the Advent Calendar. So, 25 blog posts total. The posts can be about anything related to Ruby. In my opinion, the Ruby Advent Calendar is about encouraging people to
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く