Ruby is diﬀerent today. I hear every programmer say •Ruby is a "web language" •Ruby is a "slow language"
Ruby.is_a? web language
Ruby.is_a? web language •Obviously it is!
I use Ruby because...
I use Ruby because... •I'm a web programmer.
I use Ruby because... •I'm a web programmer. •Every web programmer uses Rails.
I use Ruby because... •I'm a web programmer. •Every web programmer uses Rails. •Ruby is the language "under Rails".
Why Ruby? •Rails is my business... and business is good! •I'm not playing on Ruby, I'm just working on Rails.
I hear every programmer say •Ruby is a "web language" •Ruby is a "slow language"
Ruby.is_a? slow language
I heard people say Ruby is slow, so what shall I do?
New trolls! •Submit a CFP titled "7 reasons why Ruby is slow" for a Ruby conference. Immediately. •Be quick, or be dead you'll miss a chance to get up on stage.
7 reasons? •They say GC is slow. •They say Ruby is slow because of the "GIL" thing.
"GIL" (or GVL) • What exactly is it? • Don't ask me. I don't know. Ask @_ko1 or @kosaki55tea • No, actually you need not to know about it. • I hear every programmer say JRuby or Rubinius are better and faster than MRI because they are GIL free. So let's just throw MRI away.
GIL free! •Thank Matz Almighty, we are free at last! •Roll over @yotii23's husband, tell Patch Monster the news.
Concurrency is hardly ever heard. And mostly what we need from Ruby. • % ruby -v thread_tes.rb ruby 2.1.0dev (2013-10-14 trunk 43282) [x86_64-darwin12.5.0] 5000 • % ruby -v thread_tes.rb rubinius 2.1.1 (2.1.0 be67ed17 2013-10-18 JI) [x86_64-darwin12.5.0] 3504
But ... but I still feel like Ruby is kind of slow for me, so what can I do?
No trolls! •Submit a CFP titled "7 reasons why Ruby is slow" for a Ruby conference. Immediately.
Don't troll. Code. • Unless you're a VM programmer, shut your mouth. • That's @_Ko1's business. • That's why Heroku pays @_ko1's salary. • Instead, find a problem that YOU can deal with. • And don't let it be. Don't whisper words of wisdom. Solve it.
I know a person who actually have been doing this • He thought Rails is slow because assets are slow. • => The asset pipeline • He thought Rails is slow because we are reloading assets for every request. • => Turbolinks
He's the speed king
Your Rails app is slow because... •Kernel#require is slow •RubyGems & Bundler is slow •ActiveRecord is slow •RSpec is slow •Rack is slow
Kernel#require •@_ko1 told me that require_relative would be way faster than require •So we tried
'Cause I try and I try and I try and I try • Before: % time rails r 1 4.07s user 1.32s system 95% cpu 5.650 total % time rails r 1 3.91s user 1.15s system 99% cpu 5.087 total % time rails r 1 3.91s user 1.17s system 99% cpu 5.107 total • After: % time rails r 1 4.20s user 1.24s system 99% cpu 5.467 total % time rails r 1 3.98s user 1.17s system 99% cpu 5.167 total % time rails r 1 3.99s user 1.15s system 99% cpu 5.169 total
I can't get no! I can't get no! •NO performance improvement!
Hail, hail to Bundler •It turned out that RubyGems rewrites Kernel#require and makes it slow, but Bundler re- rewrites it and makes it fast finally.
The problems I recently found
database_cleaner is slow
10% of `time rake spec` was spent for DB cleaning •time rake spec: 14m01s •time spent on cleaning DB: 77m35s
So I rewrote database_cleaner •Come cleaning faster! •Just call `delete` if I hear `insert` •FIX ME!
Squash all gems into one directory └── all_bundled_gems_in_one └── lib >> LOAD_PATH ├── gem1 │ ├── bar.rb │ └── foo.rb ├── gem1.rb └── gem2 ├── fuga.rb └── hoge.rb
(bundle_squash) •(It should be possible) •(But not yet on the Web...)
Problems I'm willing to challenge •Make Haml faster •Or create a faster fork of Haml •Make ActiveRecord faster •Or create a faster subset of AR
Ruby.is_a? web language •(reprise)
Ruby.is_a? web language and !Ruby.is_a? web_only language •Ruby oﬀ Rails!
One thing I hate on my computer
One thing I hate on my computer
Who here are happy with the Finder.app?
Finder.app •Mr. Finder.app, what went down in your head •Your UI to me seems so tragic, with the thrill of it all
At Rails勉強会@東京 last month •We talked about how Finder.app sucks •We agreed that we need a better "filer" •And I started creating it last month.
Why Finder.app sucks
Why Finder.app sucks •Productivity •Design
Productivity • It's so hard to do simple things such as `mkdir`, `rm`, or `cd` to a hidden directory. • How can I `touch`? How can I `ln -s`? How can I `chmod`? • Telling me more and more about some useless features. Supposed to :fire: my productivity.
Design •It's white!
Paint it black! •I see a white window and I want it painted black.
Paint it black!
Paint it black! •No colors anymore I want them to turn black.
Paint it black!
So, I made my own finder •And saw that it was good.
How can Finder.app be better? •Needs to be more productive. •Needs to be painted black.