This file contains 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
a = Array.new | |
10000000.times do | |
b= Array.new | |
a.push(b) | |
end |
This file contains 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
admin2:ruby kwleland$ ruby -Xdebug x8.rb | |
An exception occurred running the debugger: | |
no such file to load -- rubinius/compiler/iseq (LoadError) | |
Backtrace: | |
Rubinius::CodeLoader#load_error at kernel/common/code_loader.rb:440 | |
Rubinius::CodeLoader#resolve_require_path at kernel/common/code_loader.rb:423 | |
{ } in Rubinius::CodeLoader#require at kernel/common/code_loader.rb:103 |
This file contains 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' | |
require 'benchmark/ips' | |
long_text = File.new('holmes.txt').read.downcase | |
#holmes.txt @ http://norvig.com/holmes.txt | |
medium_text = long_text.slice(0,1000) | |
short_text = long_text.slice(0,100) | |
Benchmark.ips do |x| | |
x.report "string scan (long length)" do |times| |
This file contains 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
Thread 1: total running time: 191.491809676s | |
% cumulative self self total | |
time seconds seconds calls ms/call ms/call name | |
------------------------------------------------------------ | |
8.36 23.56 16.02 4150098 0.00 0.01 String#[] | |
7.43 27.81 14.24 2903040 0.00 0.01 String#replace | |
7.32 35.12 14.03 1247058 0.01 0.03 String#[]= | |
6.25 63.45 11.97 2903040 0.00 0.02 String#+ | |
5.84 26.53 11.19 884179 0.01 0.03 Array::recursively_flatten<1796> {} |
This file contains 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
# Word anagrams (with duplicates). | |
# Submitted by Giovanni Intini <[email protected]> | |
class String | |
def swap(i) | |
tmp = self[0,1] | |
self[0] = self[i] | |
self[i] = tmp | |
self | |
end |
This file contains 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' | |
require 'benchmark/ips' | |
Benchmark.ips do |x| | |
s = "abcdefghijk" | |
last_index = s.length - 1 | |
middle_index = last_index/2 | |
x.report("element assignment at beginning") do |times| |
This file contains 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
Script started on Tue 07 Apr 2015 10:23:47 AM EDT | |
[root@app0 ~]# gdb -p 22482 | |
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-75.el6) | |
Copyright (C) 2010 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-redhat-linux-gnu". | |
For bug reporting instructions, please see: |
This file contains 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
Thread.new do | |
while true | |
sleep 10 | |
puts "heartbeat" | |
end | |
end | |
while true | |
ar = [] | |
100.times do |
This file contains 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
Starting program: /usr/bin/rbx ./t.rb | |
[Thread debugging using libthread_db enabled] | |
[New Thread 0x7fffef301700 (LWP 6838)] | |
[New Thread 0x7fffeef00700 (LWP 6839)] | |
[New Thread 0x7fffeeaff700 (LWP 6840)] | |
[New Thread 0x7fffee6fe700 (LWP 6841)] | |
[New Thread 0x7fffee2fd700 (LWP 6842)] | |
[New Thread 0x7fffedefc700 (LWP 6843)] | |
[New Thread 0x7fffecec7700 (LWP 6844)] | |
[New Thread 0x7ffff6179700 (LWP 6847)] |
This file contains 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
Script started on Tue 12 May 2015 01:44:04 PM EDT | |
[root@ops ~]# gdb -p 30764 | |
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1) | |
Copyright (C) 2010 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-redhat-linux-gnu". | |
For bug reporting instructions, please see: |
OlderNewer