asymptotic 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/asymptotic/graph.rb +12 -9
- data/lib/asymptotic/version.rb +1 -1
- metadata +29 -41
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c8ed9f4a8eb226cad4570bb7355e25651edd523b
|
4
|
+
data.tar.gz: dda7761bf580c217b4349ecd83722ca16879dc1a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1463529158bb8ad7a219b9b9b8ffa358fad16e02158f3e7e58e3c0afe40849b7e16e59a47905435c9a0650dd570f06ffc02307a8115ea23dc520d455a288c908
|
7
|
+
data.tar.gz: 22942023d991882830c3972d50e09587cb410329cdbd6a7db9dff91e10b07bd026af2ffbcfd23c1e53cc2445ec38672036e48f1bc998c9668feefb0041af6677
|
data/lib/asymptotic/graph.rb
CHANGED
@@ -12,24 +12,27 @@ module Asymptotic
|
|
12
12
|
Gnuplot::Plot.new(gnuplot) do |plot|
|
13
13
|
plot.title "Average Runtime Analysis of #{@problem} (#{`ruby -v`.split(' (').first})"
|
14
14
|
plot.xlabel "Input size"
|
15
|
-
plot.ylabel "Average time taken in seconds (ran #{@
|
15
|
+
plot.ylabel "Average time taken in seconds (ran #{@attempts} times)"
|
16
16
|
|
17
17
|
@algorithm_hash.each do |name, function_hash|
|
18
|
-
seeds = function_hash[:input_seeds]
|
18
|
+
seeds = function_hash[:input_seeds]
|
19
19
|
input_generation_function = function_hash[:input_function]
|
20
20
|
function = function_hash[:function]
|
21
|
-
|
22
|
-
inputs = seeds.pmap(8, &input_generation_function)
|
23
|
-
sizes = inputs.pmap(8, &:size)
|
21
|
+
sizes = []
|
24
22
|
|
25
23
|
puts "\nRunning benchmarks on: #{name}".green
|
26
|
-
runtimes =
|
24
|
+
runtimes = seeds.map do |seed|
|
27
25
|
|
28
|
-
|
26
|
+
size = 0
|
29
27
|
times_taken = ([0] * @attempts).map do
|
30
|
-
|
28
|
+
input = input_generation_function.(seed)
|
29
|
+
GC.disable
|
30
|
+
time_taken = Benchmark.realtime { function[input] }
|
31
|
+
GC.enable
|
32
|
+
size = input.size
|
33
|
+
time_taken
|
31
34
|
end
|
32
|
-
|
35
|
+
sizes << size
|
33
36
|
|
34
37
|
print '.'.yellow
|
35
38
|
average_time_taken = times_taken.inject(:+) / @attempts.to_f
|
data/lib/asymptotic/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asymptotic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.5
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aaron Cronin
|
@@ -12,85 +11,75 @@ cert_chain: []
|
|
12
11
|
date: 2013-08-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
|
-
none: false
|
21
|
-
name: bundler
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
24
|
- - ~>
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '1.3'
|
29
|
-
none: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
32
30
|
requirements:
|
33
|
-
- -
|
31
|
+
- - '>='
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: '0'
|
36
|
-
none: false
|
37
|
-
name: rake
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
|
-
none: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
42
|
+
name: colored
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
48
44
|
requirements:
|
49
|
-
- -
|
45
|
+
- - '>='
|
50
46
|
- !ruby/object:Gem::Version
|
51
47
|
version: '0'
|
52
|
-
none: false
|
53
|
-
name: colored
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
|
-
none: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
56
|
+
name: peach
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- -
|
59
|
+
- - '>='
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: '0'
|
68
|
-
none: false
|
69
|
-
name: peach
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - '>='
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: '0'
|
77
|
-
none: false
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
70
|
+
name: gnuplot
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
80
72
|
requirements:
|
81
|
-
- -
|
73
|
+
- - '>='
|
82
74
|
- !ruby/object:Gem::Version
|
83
75
|
version: '0'
|
84
|
-
none: false
|
85
|
-
name: gnuplot
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
79
|
requirements:
|
90
|
-
- -
|
80
|
+
- - '>='
|
91
81
|
- !ruby/object:Gem::Version
|
92
82
|
version: '0'
|
93
|
-
none: false
|
94
83
|
description: Toolkit for asymptotic analysis of functions
|
95
84
|
email:
|
96
85
|
- cronin@include.cat
|
@@ -110,26 +99,25 @@ files:
|
|
110
99
|
homepage: https://github.com/cronin101/asymptotic.gem
|
111
100
|
licenses:
|
112
101
|
- MIT
|
102
|
+
metadata: {}
|
113
103
|
post_install_message:
|
114
104
|
rdoc_options: []
|
115
105
|
require_paths:
|
116
106
|
- lib
|
117
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
108
|
requirements:
|
119
|
-
- -
|
109
|
+
- - '>='
|
120
110
|
- !ruby/object:Gem::Version
|
121
111
|
version: '0'
|
122
|
-
none: false
|
123
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
113
|
requirements:
|
125
|
-
- -
|
114
|
+
- - '>='
|
126
115
|
- !ruby/object:Gem::Version
|
127
116
|
version: '0'
|
128
|
-
none: false
|
129
117
|
requirements: []
|
130
118
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
119
|
+
rubygems_version: 2.1.0
|
132
120
|
signing_key:
|
133
|
-
specification_version:
|
121
|
+
specification_version: 4
|
134
122
|
summary: Toolkit for asymptotic analysis of functions
|
135
123
|
test_files: []
|