SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
JUICY RUBY 2.1
David Paluy
Founder of Azorly	

@dpaluy 

blog: david.paluy.org

Jan 2014
AGENDA
•

Overview	


•

Performance	


•

Internal Improvements	


•

Should we migrate?
POLL
•

Ruby 1.8.7	


•

JRuby	


•

Rubinius	


•

Ruby 1.9.2 -1.9.3	


•

Ruby 2.0.0	


•

Ruby 2.1.0
RUBY 2.1OVERVIEW
•

Refinements

Advice: Don’t use it, unless you really need it!
RUBY 2.1OVERVIEW
•

Decimals	

!

•

Required Keyword Arguments
RUBY 2.1 OVERVIEW
Method Definition returns Method Name	


•

!

StringScanner supports Named Captures


•





(check references)
PERFORMANCE - 

HOW TO MEASURE
but better use:
HOW TO MEASURE - HITIMES
gem install hitimes
RUBY 2.1 PERFORMANCE

…

Source: http://miguelcamba.com/blog/2013/10/05/benchmarking-the-ruby-2-dot-1-and-rubinius-2-dot-0/
RUBY 2.1 INTERNAL
IMPROVEMENTS
•

Profiling support	


•

Improved ObjectSpace	


•

Improved GC	


•

Improved method caching
PROFILING SUPPORT - (C API)
stackprof (perftools.rb replacement) https://github.com/tmm1/stackprof 	

!
!
!

Sampling modes: cpu, wall, :object, :custom	

Read more: http://tmm1.net/ruby21-profiling/
OBJECTSPACE - 

HEAP DEBUGGING UTILITIES
RGenGC: Restricted Generational
Garbage Collection
	


New generational GC algorithm permits

Write-barrier (WB) protected objects AND 	

WB un-protected object in the same heap
RGenGC - Key Idea
•

Separate Objects	

!
!

•

Shady Object points to new Object?

We don’t know!	


•

Decide at Creation

Class cares about WB and don’t cares about non-WB	


•

Normal objects can be changed to Shady objects
OLDGEN AND MINOR MARKING
!
!
•

Only protected objects can be promoted to oldgen

•

Unprotected objects cannot be promoted, but if referenced from oldgen
they are added to a remembered set.	


•

Minor marks are much faster because they only have to traverse references
from the remembered set
TUNING THE GC IN RUBY 2.1
Memory allocation → GC	

	

 •	

 Every time allocate n size memory (call malloc(n)) 

increase malloc_increase with n
	

 •	

 If malloc_increase > malloc_limit, then cause GC 	

!

Adaptive tuning	

	

 •	

 If malloc_increase exceeds malloc_limit, then increase malloc_limit

(by a factor of GC_MALLOC_LIMIT_GROWTH_FACTOR) up to
GC_MALLOC_LIMIT_MAX
GC ENVIRONMENT PARAMS
GITHUB TWEAKS
METHODS CACHE
Ruby 2.1 introduces a hierarchical class cache similar
to the what Rubinius and JRuby use	

Aman Gupta: 

“Early numbers show up to 5-10% improvements”	

!

More improvements in Ruby 2.2
PRODUCTION READY?
•

breaks the faraday gem	


•

affects the sass gem	


•

segv inside active_support_4 and other gems	


•

Performance Patches by funny-falcon
PRODUCTION READY?
!
!

Aman Gupta’s summary: 

https://gist.github.com/tmm1/8393897

Github uses Ruby 2.1 in Production
REFERENCES
•

Konstantin Haase - http://rkh.im/ruby-2.1	


•

Aaron Patterson - https://practicingruby.com/articles/parsing-json-the-hard-way?u=90296723ac	


•

Hitimes - https://github.com/copiousfreetime/hitimes	


•

Ruby Benchmark - https://github.com/acangiano/ruby-benchmark-suite	


•

Aman Gupta:

production summary - https://gist.github.com/tmm1/8393897

Ruby 2.1 - http://tmm1.net/ruby21/ 	


•

Koichi Sasada - http://rvm.jp/~ko1/activities/rubyconf2013-ko1_pub.pdf 	


•

James Golick - http://jamesgolick.com/2013/4/14/mris-method-caches.html
THANK YOU!	

@DPALUY

Mais conteúdo relacionado

Destaque

(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
(ISM213) Building and Deploying a Modern Big Data Architecture on AWS(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
Amazon Web Services
 
history of modern architecture - lecture 01
history of modern architecture - lecture 01history of modern architecture - lecture 01
history of modern architecture - lecture 01
Shahril Khairi
 

Destaque (11)

IDC Retail Insights - What's Possible with a Modern Data Architecture?
IDC Retail Insights - What's Possible with a Modern Data Architecture?IDC Retail Insights - What's Possible with a Modern Data Architecture?
IDC Retail Insights - What's Possible with a Modern Data Architecture?
 
Red Hat - Presentation at Hortonworks Booth - Strata 2014
Red Hat - Presentation at Hortonworks Booth - Strata 2014Red Hat - Presentation at Hortonworks Booth - Strata 2014
Red Hat - Presentation at Hortonworks Booth - Strata 2014
 
(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
(ISM213) Building and Deploying a Modern Big Data Architecture on AWS(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
(ISM213) Building and Deploying a Modern Big Data Architecture on AWS
 
Building a Modern Data Architecture by Ben Sharma at Strata + Hadoop World Sa...
Building a Modern Data Architecture by Ben Sharma at Strata + Hadoop World Sa...Building a Modern Data Architecture by Ben Sharma at Strata + Hadoop World Sa...
Building a Modern Data Architecture by Ben Sharma at Strata + Hadoop World Sa...
 
Data in Motion - Data at Rest - Hortonworks a Modern Architecture
Data in Motion - Data at Rest - Hortonworks a Modern ArchitectureData in Motion - Data at Rest - Hortonworks a Modern Architecture
Data in Motion - Data at Rest - Hortonworks a Modern Architecture
 
The path to a Modern Data Architecture in Financial Services
The path to a Modern Data Architecture in Financial ServicesThe path to a Modern Data Architecture in Financial Services
The path to a Modern Data Architecture in Financial Services
 
Delivering a Flexible IT Infrastructure for Analytics on IBM Power Systems
Delivering a Flexible IT Infrastructure for Analytics on IBM Power SystemsDelivering a Flexible IT Infrastructure for Analytics on IBM Power Systems
Delivering a Flexible IT Infrastructure for Analytics on IBM Power Systems
 
history of modern architecture - lecture 01
history of modern architecture - lecture 01history of modern architecture - lecture 01
history of modern architecture - lecture 01
 
modern, post-modern architects & their works
modern, post-modern architects & their worksmodern, post-modern architects & their works
modern, post-modern architects & their works
 
Getting involved with Open Source at the ASF
Getting involved with Open Source at the ASFGetting involved with Open Source at the ASF
Getting involved with Open Source at the ASF
 
Scaling real time streaming architectures with HDF and Dell EMC Isilon
Scaling real time streaming architectures with HDF and Dell EMC IsilonScaling real time streaming architectures with HDF and Dell EMC Isilon
Scaling real time streaming architectures with HDF and Dell EMC Isilon
 

Semelhante a Juicy Ruby 2.1

Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Michael Kimathi
 

Semelhante a Juicy Ruby 2.1 (20)

Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
DevCon-Shikhar Slides
DevCon-Shikhar SlidesDevCon-Shikhar Slides
DevCon-Shikhar Slides
 
Ruby Plugins for Jenkins
Ruby Plugins for JenkinsRuby Plugins for Jenkins
Ruby Plugins for Jenkins
 
Rails performance at Justin.tv - Guillaume Luccisano
Rails performance at Justin.tv - Guillaume LuccisanoRails performance at Justin.tv - Guillaume Luccisano
Rails performance at Justin.tv - Guillaume Luccisano
 
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB MeetupMariaDB 10.1   what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
MariaDB 10.1 what's new and what's coming in 10.2 - Tokyo MariaDB Meetup
 
Rubinius 1.0 and more!
Rubinius 1.0 and more!Rubinius 1.0 and more!
Rubinius 1.0 and more!
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
Opal,The Journey from Javascript to Ruby at Ruby Conf Kenya 2017 by Bozhidar ...
 
Rails 5 subjective overview
Rails 5 subjective overviewRails 5 subjective overview
Rails 5 subjective overview
 
[Hadoop Meetup] Yarn at Microsoft - The challenges of scale
[Hadoop Meetup] Yarn at Microsoft - The challenges of scale[Hadoop Meetup] Yarn at Microsoft - The challenges of scale
[Hadoop Meetup] Yarn at Microsoft - The challenges of scale
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
What would your own version of Ruby look like?
What would your own version of Ruby look like?What would your own version of Ruby look like?
What would your own version of Ruby look like?
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
MyRocks in MariaDB: why and how
MyRocks in MariaDB: why and howMyRocks in MariaDB: why and how
MyRocks in MariaDB: why and how
 

Mais de David Paluy

Security on Rails
Security on RailsSecurity on Rails
Security on Rails
David Paluy
 
Ruby On Rails coding conventions, standards and best practices
Ruby On Rails coding conventions, standards and best practicesRuby On Rails coding conventions, standards and best practices
Ruby On Rails coding conventions, standards and best practices
David Paluy
 
Howto prepare fund raising presentation
Howto prepare fund raising presentationHowto prepare fund raising presentation
Howto prepare fund raising presentation
David Paluy
 

Mais de David Paluy (15)

Intro to Smart Contracts
Intro to Smart ContractsIntro to Smart Contracts
Intro to Smart Contracts
 
Decentralizing Everything with Blockchain
Decentralizing Everything with BlockchainDecentralizing Everything with Blockchain
Decentralizing Everything with Blockchain
 
Testing with Rspec 3
Testing with Rspec 3Testing with Rspec 3
Testing with Rspec 3
 
Continuous integration for Ruby on Rails
Continuous integration for Ruby on RailsContinuous integration for Ruby on Rails
Continuous integration for Ruby on Rails
 
Tdd - Test Driven Development
Tdd - Test Driven DevelopmentTdd - Test Driven Development
Tdd - Test Driven Development
 
Knowledge sharing at MESH
Knowledge sharing at MESHKnowledge sharing at MESH
Knowledge sharing at MESH
 
The Secret: How Programmers Develop Code
The Secret: How Programmers Develop CodeThe Secret: How Programmers Develop Code
The Secret: How Programmers Develop Code
 
Tools to help you understand other people's code
Tools to help you understand other people's codeTools to help you understand other people's code
Tools to help you understand other people's code
 
Debugging and Profiling Rails Application
Debugging and Profiling Rails ApplicationDebugging and Profiling Rails Application
Debugging and Profiling Rails Application
 
Security on Rails
Security on RailsSecurity on Rails
Security on Rails
 
Ruby On Rails coding conventions, standards and best practices
Ruby On Rails coding conventions, standards and best practicesRuby On Rails coding conventions, standards and best practices
Ruby On Rails coding conventions, standards and best practices
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Faster on Rails
Faster on RailsFaster on Rails
Faster on Rails
 
Howto prepare fund raising presentation
Howto prepare fund raising presentationHowto prepare fund raising presentation
Howto prepare fund raising presentation
 
Test driven-development
Test driven-developmentTest driven-development
Test driven-development
 

Juicy Ruby 2.1