$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ ruby slow_require.rb
3.15ms - time
21.05ms - oj/error
85.68ms - not_exist_file1
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
https://blog.skylight.io/hunting-for-leaks-in-ruby/ | |
http://www.be9.io/2015/09/21/memory-leak/ | |
https://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby |
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
Allocated String Report | |
----------------------------------- | |
9720 "TrainingLogSportParamValue" | |
2300 /usr/local/lib/ruby/gems/2.3.0/bundler/gems/db-charmer-2efc0e10d3be/lib/db_charmer/active_record/class_attributes.rb:49 | |
2270 /usr/local/lib/ruby/gems/2.3.0/bundler/gems/db-charmer-2efc0e10d3be/lib/db_charmer/active_record/class_attributes.rb:20 | |
2110 /usr/local/lib/ruby/gems/2.3.0/bundler/gems/db-charmer-2efc0e10d3be/lib/db_charmer/active_record/class_attributes.rb:82 | |
1150 /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:606 | |
940 /usr/local/lib/ruby/gems/2.3.0/bundler/gems/db-charmer-2efc0e10d3be/lib/db_charmer/active_record/class_attributes.rb:30 | |
840 /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/scoping.rb:14 | |
40 /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.5/lib/active_record/core.rb:221 |
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
$ crystal regex.cr | |
Syntax error in ./regex.cr:1: invalid regex: support for \P, \p, and \X has not been compiled at 4 | |
puts " \# ".gsub /\\(\p{P})/, '\1' |
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
N = 7 | |
tmp_array = Array.new(N) { Array.new(N) { 0 } } | |
result = Array.new(N) { Array.new(N) { 0 } } | |
k = 0 | |
N.times do |i| | |
N.times do |j| | |
k += 1 |
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
Пять самых клевых чуваков, | |
Которых нет милей и краше, | |
Пять гениальнейших умов, | |
Творят на Благо Эйч2Раша. | |
Вот Шалико - надежный друг, | |
В беде поможет всем вокруг, | |
Ему усталость не почем, | |
Он лидер и знаток во всем. |
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
module Rubinius | |
config = {} | |
config[:config_file] = "/home/kirill/code/rubinius/config.rb" | |
config[:build_tool_gems] = [["rubinius-ast", "2.0.8"], ["rubinius-compiler", "2.0.4"], ["rubinius-melbourne", "2.0.0.19"], ["rubinius-processor", "2.0.1"], ["rubinius-toolset", "0.1.1"], ["ffi2-generators", "0.1.1"]] | |
config[:build_c_ext_gems] = [["rubysl-etc", "2.0.3"], ["rubysl-fileutils", "2.0.2"], ["rubysl-mkmf", "2.0.1"], ["rubysl-shellwords", "2.0.0"]] | |
config[:rubygems_gems] = [["psych", "2.0.1"], ["rubysl-date", "2.0.5"], ["rubysl-delegate", "2.0.0"], ["rubysl-digest", "2.0.2"], ["rubysl-fcntl", "2.0.4"], ["rubysl-monitor", "2.0.0"], ["rubysl-net-http", "2.0.4"], ["rubysl-net-protocol", "2.0.1"], ["rubysl-openssl", "2.0.0"], ["rubysl-optparse", "2.0.1"], ["rubysl-ostruct", "2.0.4"], ["rubysl-resolv", "2.0.0"], ["rubysl-socket", "2.0.1"], ["rubysl-stringio", "2.0.0"], ["rubysl-strscan", "2.0.0"], ["rubysl-tempfile", "2.0.0"], ["rubysl-thread", "2.0.2"], ["rubysl-time", "2.0.3"], ["rubysl-timeout", "2.0.0"] |
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
user system total real | |
via_uniq_and_count 6.340000 0.000000 6.340000 ( 6.356359) | |
via_each 1.250000 0.000000 1.250000 ( 1.259036) |
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 'text-table' | |
class SpiralMatrix | |
DIRECTIONS = [ | |
{ x: 1, y: 0 }, | |
{ x: 0, y: 1 }, | |
{ x: -1, y: 0 }, | |
{ x: 0, y: -1 } | |
] |
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
# Стандартные роуты для collection | |
# pages GET /pages(.:format) pages#index | |
# POST /pages(.:format) pages#create | |
# new_page GET /pages/new(.:format) pages#new | |
# | |
# Стандартные роуты для member | |
# edit_page GET /pages/:id/edit(.:format) pages#edit | |
# page GET /pages/:id(.:format) pages#show | |
# PUT /pages/:id(.:format) pages#update | |
# DELETE /pages/:id(.:format) pages#destroy |
NewerOlder