# rubinius/rubinius

Switch branches/tags
Nothing to show
Commits on Feb 15, 2011
1. Evan Phoenix committed Feb 15, 2011
2. Evan Phoenix committed Feb 15, 2011
3. Evan Phoenix committed Feb 15, 2011
4. Evan Phoenix committed Feb 15, 2011
5. Evan Phoenix committed Feb 15, 2011
6. Evan Phoenix committed Feb 15, 2011
7. Evan Phoenix committed Feb 15, 2011
8. Evan Phoenix committed Feb 15, 2011
9. Evan Phoenix committed Feb 15, 2011
10. Evan Phoenix committed Feb 15, 2011
11. Evan Phoenix committed Feb 15, 2011
12. Evan Phoenix committed Feb 15, 2011
Commits on Feb 14, 2011
1. Evan Phoenix committed Feb 14, 2011
2. Evan Phoenix committed Feb 14, 2011
3. Evan Phoenix committed Feb 14, 2011
4. Evan Phoenix committed Feb 14, 2011
5. Evan Phoenix committed Feb 14, 2011
6. Evan Phoenix committed Feb 14, 2011
Commits on Feb 12, 2011
1. seydar committed Feb 12, 2011
2. seydar committed Feb 12, 2011
```…sertion sort or quicksort. The threshold was 6, but it is now 13. Results and methodology below.

## Code

def quicksort(v, tally=[])
return v if v.nil? or v.length <= 1
less, more = v[1..-1].partition { |i| tally << 1; i < v[0] }
quicksort(less, tally) + [v[0]] + quicksort(more, tally)
end

def qsort(v)
array = []
quicksort(v, array)
array.size
end

def isort(list)
tally = 0
for i in 1..(list.length - 1)
value = list[i]
j = i - 1
while j >= 0 and list[j] > value
list[j + 1] = list[j]
j -= 1
tally += 1
end
list[j + 1] = value
end
tally
end

def random_array(size)
array = []
size.times { array << rand(1_000_000) }
array
end

class Array
def average
sum / size
end

def sum
inject(0) {|s, v| s + v }
end
end

#################################
q_results = Array.new(51) { [] }
i_results = Array.new(51) { [] }

10_000.times do
(1..50).map do |i|
q_results[i] << qsort(random_array(i))
i_results[i] << isort(random_array(i))
end
end

puts "Size\t| Quicksort\t| Insertio[i].average}\t| #{i_results[i].average}"
end

## Results
Size    | Quicksort     | Insertion sort
1       | 0     | 0
2       | 1     | 0
3       | 2     | 1
4       | 4     | 2
5       | 7     | 5
6       | 10    | 7
7       | 13    | 10
8       | 16    | 14
9       | 20    | 17
10      | 24    | 22
11      | 28    | 27
12      | 32    | 32
13      | 37    | 38
14      | 41    | 45
15      | 46    | 52
16      | 51    | 59
17      | 55    | 68
18      | 60    | 76
19      | 65    | 85
20      | 71    | 94
21      | 76    | 104
22      | 81    | 115
23      | 87    | 126
24      | 92    | 138
25      | 98    | 150
26      | 104   | 162
27      | 110   | 175
28      | 115   | 188
29      | 121   | 203
30      | 127   | 217
31      | 134   | 232
32      | 139   | 247
33      | 145   | 264
34      | 152   | 280
35      | 158   | 297
36      | 164   | 314
37      | 171   | 333
38      | 177   | 351
39      | 184   | 370
40      | 191   | 390
41      | 197   | 410
42
43      | 211   | 452
44      | 216   | 472
45      | 224   | 494
46      | 231   | 517
47      | 238   | 541
48      | 244   | 563
49      | 251   | 588
50      | 258   | 612

real    1m57.527s
user    1m56.007s
sys     0m0.314s

## uname -a
Darwin baits-190183.reshall.umich.edu 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 i386```
Commits on Feb 11, 2011
1. wycats committed Feb 11, 2011
2. wycats committed Feb 11, 2011
3. wycats committed Feb 11, 2011
4. wycats committed Feb 11, 2011
5. wycats committed Feb 11, 2011
Commits on Feb 9, 2011
1. wycats committed Feb 9, 2011
`…nd add a stub for a stage customization document`
2. wycats committed Feb 9, 2011
3. wycats committed Feb 9, 2011
4. wycats committed Feb 9, 2011
`…age for customizing the Rubinius compiler pipeline`
Commits on Feb 8, 2011
1. Evan Phoenix committed Feb 8, 2011
2. Evan Phoenix committed Feb 8, 2011
3. Brian Ford committed Feb 8, 2011
4. Evan Phoenix committed Feb 8, 2011
Commits on Feb 5, 2011
1. spastorino committed Feb 5, 2011
`…cutives. Closes #625`
2. spastorino committed Feb 5, 2011