This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark/ips' | |
| hash = { instagram_account_id: '1235456', access_token: 'access_token', user_name: 'name' } | |
| Benchmark.ips do |x| | |
| x.report('set') { $redis.set('test_get', hash.to_json); } | |
| x.report('hmset') { $redis.hmset('test_hmset', *hash); } | |
| x.compare! | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bench value | |
| Benchmark.ips do |x| | |
| x.report('split') do | |
| value_parts = value.split('.') | |
| fraction = value_parts.pop if value_parts.size > 1 | |
| integer = value_parts.join('').gsub(/[ ]/, '') | |
| result = fraction ? "#{integer}.#{fraction}" : integer | |
| end | |
| x.report('split2') do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Настройка ubuntu для работы с rails | |
| # Install git | |
| sudo apt-get install git | |
| # Install zsh | |
| sudo apt-get install zsh | |
| curl -L http://install.ohmyz.sh | sh | |
| sudo chsh -s $(which zsh) $(whoami) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # В файл /etc/sysctl.conf добавить | |
| #vm.swappiness=5 | |
| #vm.laptop_mode = 5 | |
| #vm.dirty_writeback_centisecs = 6000 | |
| # В файл /etc/fstab к опциям монтирования разделов | |
| #,noatime,discard,commit=600 | |
| # к опциям btrfs нужно добавить ssd | |
| # From http://compizomania.blogspot.com/2013/10/ubuntu-1310_6239.html |