I went to Lone Star Ruby Conf in Austin, TX last week. I also spoke about math in Ruby.
I have presented at Chicago Java Users Group in the past, but this was the first conference I spoke it. I practiced my presentation a few times before, but I still went a bit too fast. But some people were interested in the topic.
For now, I will dump some notes I took at the conference.
2012-08-11_12.20.14
Ruby Conf:
extend versus include:
an instance can extend a module
A class includes a module
You may only need to extend in certain places
DCI: Extending objects at runtime where it makes sense
DCI (Data Context Interaction)
ActionController has 361 methods (Object has 134 out of the box) (8th Light U was about something similar today)
http://jamesgolick.com/2012/5/22/objectify-a-better-way-to-build-rails-applications.html
2012-08-11_13.35.08
Performance in Ruby
Languages are not necessarily slow. Comes down to “big-O”
Majority of performance issues:
poor choice of data structures, algorithms (N + 1), capped speed of light
o(1), o(logn), o(n) (45 degree angle), o(n^2) (almost straight up)
twitter client in Ruby called “t”
lots of dependencies
$LOADED_FEATURES can be pretty big
Rails has 784 $LOADED_FEATURES
Watch this as you build your app
This is just startup time, not runtime – this is why free Heroku apps can take a while to start up
BRPOPLPUSH in Redis helped them out
Look at his Rails app: https://github.com/kowsik/vroom running at vroom-ruby.heroku.com
hit-rate: numbers of requests/second, not same as average response time
conurrency: number of open sockets, aka simultaneous users
single threaded sinatra has concurrency of one
Connection pools: jamming a lot of requests into size of your connection pool
Redis: they put it in front of Couch DB
Redis command docs will give you the big-o factor
sets can be o(n)
Some things in Lists can be o(n)
sets: sinter, sinterstore is o(n*m) – intersection of sets
Did I mention I met Matz?
Image from Aurora Consurgens, a 15th century manuscript housed at Central Library of Zurich. Image from e-Codices. This image is assumed to be allowed under Fair Use.