external 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/History +5 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +168 -0
  4. data/lib/ext_arc.rb +108 -0
  5. data/lib/ext_arr.rb +727 -0
  6. data/lib/ext_ind.rb +1120 -0
  7. data/lib/external/base.rb +85 -0
  8. data/lib/external/chunkable.rb +105 -0
  9. data/lib/external/enumerable.rb +137 -0
  10. data/lib/external/io.rb +398 -0
  11. data/lib/external.rb +3 -0
  12. data/test/benchmarks/benchmarks_20070918.txt +45 -0
  13. data/test/benchmarks/benchmarks_20070921.txt +91 -0
  14. data/test/benchmarks/benchmarks_20071006.txt +147 -0
  15. data/test/benchmarks/test_copy_file.rb +80 -0
  16. data/test/benchmarks/test_pos_speed.rb +47 -0
  17. data/test/benchmarks/test_read_time.rb +55 -0
  18. data/test/cached_ext_ind_test.rb +219 -0
  19. data/test/check/benchmark_check.rb +441 -0
  20. data/test/check/namespace_conflicts_check.rb +23 -0
  21. data/test/check/pack_check.rb +90 -0
  22. data/test/ext_arc_test.rb +286 -0
  23. data/test/ext_arr/alt_sep.txt +3 -0
  24. data/test/ext_arr/cr_lf_input.txt +3 -0
  25. data/test/ext_arr/input.index +0 -0
  26. data/test/ext_arr/input.txt +1 -0
  27. data/test/ext_arr/inputb.index +0 -0
  28. data/test/ext_arr/inputb.txt +1 -0
  29. data/test/ext_arr/lf_input.txt +3 -0
  30. data/test/ext_arr/lines.txt +19 -0
  31. data/test/ext_arr/without_index.txt +1 -0
  32. data/test/ext_arr_test.rb +534 -0
  33. data/test/ext_ind_test.rb +1472 -0
  34. data/test/external/base_test.rb +74 -0
  35. data/test/external/chunkable_test.rb +182 -0
  36. data/test/external/index/input.index +0 -0
  37. data/test/external/index/inputb.index +0 -0
  38. data/test/external/io_test.rb +414 -0
  39. data/test/external_test_helper.rb +31 -0
  40. data/test/external_test_suite.rb +4 -0
  41. data/test/test_array.rb +1192 -0
  42. metadata +104 -0
@@ -0,0 +1,398 @@
1
+ require 'stringio'
2
+ require 'tempfile'
3
+ require 'external/chunkable'
4
+
5
+ module External
6
+ # Position gets IO objects to work properly for large files. Additionally,
7
+ # IO adds a length accessor for getting the size of the IO contents. Note
8
+ # that length is not automatically adjusted by write, for performance
9
+ # reasons. length must be managed manually, or reset after writes using
10
+ # reset_length.
11
+ #
12
+ # A variety of bugs needed to be addressed per-platform:
13
+ #
14
+ # == Mac OS X Tiger
15
+ #
16
+ # Using the default (broken) installation of Ruby, StringIO does not correctly
17
+ # position itself when a pos= statement is issued.
18
+ #
19
+ # s = StringIO.new "abc"
20
+ # s.read # => "abc"
21
+ # s.pos = 0
22
+ # s.read # => nil
23
+ #
24
+ # For regular IO objects, as expected, the second read statement returns
25
+ # "abc". Install the a fixed version of Ruby, perhaps with the one-click
26
+ # installer: http://rubyosx.rubyforge.org/
27
+ #
28
+ # == Windows
29
+ #
30
+ # Ruby on Windows has problems with files larger than ~2 gigabytes.
31
+ # Sizes return as negative, and positions cannot be set beyond the max
32
+ # size of a long (2147483647 ~ 2GB = 2475636895). IO corrects both of
33
+ # these issues thanks in large part to a bit of code taken from
34
+ # 'win32/file/stat' (http://rubyforge.org/projects/win32utils/).
35
+ #
36
+ # == Others
37
+ #
38
+ # I haven't found errors on Fedora and haven't tested on any other platforms.
39
+ # If you find and solve some wierd positioning errors, please let me know.
40
+ module IO
41
+
42
+ # Determines the generic mode of the input io using the _mode
43
+ # method for the input io class. By default IO provides _mode
44
+ # methods for File, Tempfile, and StringIO. The return string
45
+ # is determined as follows:
46
+ #
47
+ # readable & writable:: r+
48
+ # readable:: r
49
+ # writable:: w
50
+ #
51
+ # The _mode method takes the input io and should return an array
52
+ # specifying whether or not io is readable and writable
53
+ # (ie [readable, writable]).
54
+ #
55
+ # See try_handle for more details.
56
+ def self.mode(io)
57
+ readable, writable = try_handle(io, "mode")
58
+
59
+ case
60
+ when readable && writable then "r+"
61
+ when readable then "r"
62
+ when writable then "w"
63
+ else
64
+ # occurs for r+ mode, for some reason
65
+ "r+"
66
+ end
67
+ end
68
+
69
+ # Determines the length of the input io using the _length method
70
+ # for the input io class. Non-External::IO inputs are extended
71
+ # in this process.
72
+ #
73
+ # The _length method takes the input io, and should return the
74
+ # current length of the input io (ie a flush operation may be
75
+ # required).
76
+ #
77
+ # See try_handle for more details.
78
+ def self.length(io)
79
+ case io
80
+ when External::IO
81
+ try_handle(io, "length")
82
+ else
83
+ io.extend External::IO
84
+ io.length
85
+ end
86
+ end
87
+
88
+ # Returns an array of bools determining if the input File
89
+ # is readable and writable.
90
+ def self.file_mode(io)
91
+ begin
92
+ dup = io.dup
93
+
94
+ # determine readable/writable by sending close methods
95
+ # to the duplicated IO. If the io cannot be closed for
96
+ # read/write then it will raise an error, indicating that
97
+ # it was not open in the given mode.
98
+ [:close_read, :close_write].collect do |method|
99
+ begin
100
+ dup.send(method)
101
+ true
102
+ rescue(IOError)
103
+ false
104
+ end
105
+ end
106
+ ensure
107
+ # Be sure that the io is fully closed before proceeding!
108
+ # (Otherwise Tempfiles will not be properly disposed of
109
+ # ... at least on Windows, perhaps on others)
110
+ dup.close if dup && !dup.closed?
111
+ end
112
+ end
113
+
114
+ # Returns the length of the input File
115
+ def self.file_length(io)
116
+ io.fsync unless io.generic_mode == 'r'
117
+ File.size(io.path)
118
+ end
119
+
120
+ # Returns an array of bools determining if the input Tempfile
121
+ # is readable and writable.
122
+ def self.tempfile_mode(io)
123
+ file_mode(io.instance_variable_get("@tmpfile"))
124
+ end
125
+
126
+ # Returns the length of the input Tempfile
127
+ def self.tempfile_length(io)
128
+ file_length(io)
129
+ end
130
+
131
+ # Returns an array of bools determining if the input StringIO
132
+ # is readable and writable.
133
+ #
134
+ # s = StringIO.new("abcde", "r+")
135
+ # External::IO.stringio_mode(s) # => [true, true]
136
+ #
137
+ def self.stringio_mode(io)
138
+ [!io.closed_read?, !io.closed_write?]
139
+ end
140
+
141
+ # Returns the length of the input StringIO
142
+ #
143
+ # s = StringIO.new("abcde", "r+")
144
+ # External::IO.length(s) # => 5
145
+ #
146
+ def self.stringio_length(io)
147
+ io.string.length
148
+ end
149
+
150
+ def self.extended(base) # :nodoc:
151
+ base.instance_variable_set("@generic_mode", mode(base))
152
+ base.reset_length
153
+ base.default_blksize = 1024
154
+ base.binmode
155
+ end
156
+
157
+ protected
158
+
159
+ # try_handle is a forwarding method allowing External::IO to handle
160
+ # non-File, non-Tempfile IO objects. try_handle infers a method
161
+ # name based on the class of the input and trys to forward the
162
+ # input io to that method within External::IO. For instance:
163
+ #
164
+ # * the _mode method for StringIO is 'stringio_mode'
165
+ # * the _length method for StringIO is 'stringio_length'
166
+ #
167
+ # Nested classes have '::' replaced by '_'. Thus to add support
168
+ # for Some::Unknown::IO, extend External::IO as below:
169
+ #
170
+ # module External::IO
171
+ # def some_unknown_io_mode(io)
172
+ # ...
173
+ # end
174
+ #
175
+ # def some_unknown_io_length(io)
176
+ # ...
177
+ # end
178
+ # end
179
+ #
180
+ # See stringio_mode and stringio_length for more details.
181
+ def self.try_handle(io, method)
182
+ method_name = io.class.to_s.downcase.gsub(/::/, "_") + "_#{method}"
183
+ if self.respond_to?(method_name)
184
+ External::IO.send(method_name, io)
185
+ else
186
+ raise "cannot determine #{method} for '%s'" % io.class
187
+ end
188
+ end
189
+
190
+ public
191
+
192
+ include Chunkable
193
+ attr_reader :generic_mode
194
+
195
+ # True if self is a File or Tempfile
196
+ def file?
197
+ self.kind_of?(File) || self.kind_of?(Tempfile)
198
+ end
199
+
200
+ # Modified truncate that adjusts length
201
+ def truncate(n)
202
+ super
203
+ self.pos = n if self.pos > n
204
+ self.length = n
205
+ end
206
+
207
+ # Resets length to the length returned by External::IO.length
208
+ def reset_length
209
+ self.length = External::IO.length(self)
210
+ end
211
+
212
+ #
213
+ # comparison
214
+ #
215
+
216
+ # Quick comparision with another IO. Returns true if
217
+ # another == self, or if both are file-type IOs and
218
+ # their paths are equal.
219
+ def quick_compare(another)
220
+ self == another || (self.file? && another.file? && self.path == another.path)
221
+ end
222
+
223
+ # Sort compare with another IO, behaving like a comparison between
224
+ # the full string contents of self and another. Can be a long
225
+ # operation if it requires the full read of two large IO objects.
226
+ def sort_compare(another, blksize=default_blksize)
227
+ # equal in comparison if the ios are equal
228
+ return 0 if quick_compare(another)
229
+
230
+ if another.length > self.length
231
+ return -1
232
+ elsif self.length < another.length
233
+ return 1
234
+ else
235
+ self.flush unless self.generic_mode == 'r'
236
+ self.pos = 0
237
+ another.flush unless another.generic_mode == 'r'
238
+ another.pos = 0
239
+
240
+ sa = sb = nil
241
+ while sa == sb
242
+ sa = self.read(blksize)
243
+ sb = another.read(blksize)
244
+ break if sa.nil? || sb.nil?
245
+ end
246
+
247
+ sa.to_s <=> sb.to_s
248
+ end
249
+ end
250
+
251
+ # Sort compare with another IO, behaving like a comparison between
252
+ # the full string contents of self and another. Can be a long
253
+ # operation if it requires the full read of two large IO objects.
254
+ def <=>(another)
255
+ sort_compare(another)
256
+ end
257
+
258
+ #
259
+ # reading
260
+ #
261
+
262
+ def scan(range_or_span=default_span, blksize=default_blksize, carryover_limit=default_blksize)
263
+ carryover = 0
264
+ chunk(range_or_span, blksize) do |offset, length|
265
+ raise "carryover exceeds limit: #{carryover} (#{carryover_limit})" if carryover > carryover_limit
266
+
267
+ scan_begin = offset - carryover
268
+ self.pos = scan_begin
269
+ string = self.read(length + carryover)
270
+ carryover = yield(scan_begin, string)
271
+ end
272
+ carryover
273
+ end
274
+
275
+ #
276
+ # writing
277
+ #
278
+
279
+ #
280
+ def insert(src, range=0..src.length, pos=nil)
281
+ self.pos = pos unless pos == nil
282
+
283
+ start_pos = self.pos
284
+ length_written = 0
285
+
286
+ src.flush unless src.generic_mode == 'r'
287
+ src.pos = range.begin
288
+ src.chunk(range) do |offset, length|
289
+ length_written += write(src.read(length))
290
+ end
291
+
292
+ end_pos = start_pos + length_written
293
+ self.length = end_pos if end_pos > self.length
294
+ length_written
295
+ end
296
+
297
+ #
298
+ def concat(src, range=0..src.length)
299
+ insert(src, range, length)
300
+ end
301
+
302
+ #--
303
+ # it appears that as long as the io opening t.path closes,
304
+ # the tempfile will be deleted at the exit of the ruby
305
+ # instance... otherwise it WILL NOT BE DELETED
306
+ # Make note of this in the documentation to be sure to close
307
+ # files if you start inserting because it may make tempfiles
308
+ #++
309
+ def copy(mode="r", range=0..length)
310
+ self.flush
311
+
312
+ temp = Tempfile.new("copy")
313
+ temp.extend IO
314
+ temp.insert(self, range)
315
+ temp.close
316
+
317
+ cp = File.open(temp.path, mode)
318
+ cp.extend IO
319
+
320
+ if block_given?
321
+ begin
322
+ yield(cp)
323
+ ensure
324
+ cp.close unless cp.closed?
325
+ FileUtils.rm(cp.path) if File.exists?(cp.path)
326
+ end
327
+ else
328
+ cp
329
+ end
330
+ end
331
+
332
+ end
333
+ end
334
+
335
+ # This code block modifies IO only if running on windows
336
+ unless RUBY_PLATFORM.index('mswin').nil?
337
+ require 'Win32API'
338
+
339
+ module External
340
+ module IO
341
+ # Modfied to properly determine file lengths on Windows. Uses code
342
+ # from 'win32/file/stat' (http://rubyforge.org/projects/win32utils/)
343
+ def self.file_length(io) # :nodoc:
344
+ io.fsync unless io.generic_mode == 'r'
345
+
346
+ # I would have liked to use win32/file/stat to do this... however, some issue
347
+ # arose involving FileUtils.cp, File.stat, and File::Stat.mode. cp raised an
348
+ # error because the mode would be nil for files. I wasn't sure how to fix it,
349
+ # so I've lifted the relevant code for pulling the large file size.
350
+
351
+ # Note this is a simplified version... if you base.path point to a chardev,
352
+ # this may need to be changed, because apparently the call to the Win32API
353
+ # may fail
354
+
355
+ stat_buf = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].pack('ISSssssIILILILIL')
356
+ Win32API.new('msvcrt', '_stat64', 'PP', 'I').call(io.path, stat_buf)
357
+ stat_buf[24, 4].unpack('L').first # Size of file in bytes
358
+ end
359
+
360
+ POSITION_MAX = 2147483647 # maximum size of long
361
+
362
+ # Modified to handle positions past the 2Gb limit
363
+ def pos # :nodoc:
364
+ @pos || super
365
+ end
366
+
367
+ # Positions larger than the max value of a long cannot be directly given
368
+ # to the default +pos=+. This version incrementally seeks to positions
369
+ # beyond the maximum, if necessary.
370
+ #
371
+ # Note: setting the position beyond the 2Gb limit requires the use of a
372
+ # sysseek statement. As such, errors will arise if you try to position
373
+ # an IO object that does not support this method (for example StringIO...
374
+ # but then what are you doing with a 2Gb StringIO anyhow?)
375
+ def pos=(pos)
376
+ if pos < POSITION_MAX
377
+ super(pos)
378
+ @pos = nil
379
+ elsif @pos != pos
380
+ # note sysseek appears to be necessary here, rather than io.seek
381
+ @pos = pos
382
+
383
+ super(POSITION_MAX)
384
+ pos -= POSITION_MAX
385
+
386
+ while pos > POSITION_MAX
387
+ pos -= POSITION_MAX
388
+ self.sysseek(POSITION_MAX, Object::IO::SEEK_CUR)
389
+ end
390
+
391
+ self.sysseek(pos, Object::IO::SEEK_CUR)
392
+ end
393
+ end
394
+
395
+ end
396
+ end
397
+
398
+ end # end the windows-specific code
data/lib/external.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'ext_ind'
2
+ require 'ext_arr'
3
+ require 'ext_arc'
@@ -0,0 +1,45 @@
1
+ ############################################
2
+ # Index with batch processing
3
+ ############################################
4
+
5
+ ............
6
+ test_element_assignment_speed
7
+ user system total real
8
+ I
9
+ 10kx [index]= 0.160000 0.050000 0.210000 ( 0.208374)
10
+ 10kx [range]= 11.510000 13.240000 24.750000 ( 28.489626)
11
+ 10kx [s,1]= 11.490000 13.010000 24.500000 ( 27.930727)
12
+
13
+ IIIIIIIIII
14
+ 10kx [index]= 0.220000 0.050000 0.270000 ( 0.263851)
15
+ 10kx [range]= 11.390000 13.790000 25.180000 ( 28.857814)
16
+ 10kx [s,1]= 11.590000 13.920000 25.510000 ( 28.947041)
17
+
18
+ array reference
19
+ 10kx [index]= 0.000000 0.000000 0.000000 ( 0.003049)
20
+ 10kx [range]= 0.010000 0.000000 0.010000 ( 0.006701)
21
+ 10kx [s,1]= 0.000000 0.000000 0.000000 ( 0.005084)
22
+
23
+ .
24
+ test_element_reference_speed
25
+ user system total real
26
+ I
27
+ 100kx [index] 1.590000 0.640000 2.230000 ( 2.226855)
28
+ 100kx [range] 0.670000 0.000000 0.670000 ( 0.674267)
29
+ 100kx [s,1] 2.140000 0.710000 2.850000 ( 3.660551)
30
+ 100kx [s,100] 11.110000 0.680000 11.790000 ( 11.797169)
31
+
32
+ IIIIIIIIII
33
+ 100kx [index] 0.380000 0.000000 0.380000 ( 0.381269)
34
+ 100kx [range] 0.590000 0.000000 0.590000 ( 0.596402)
35
+ 100kx [s,1] 0.460000 0.000000 0.460000 ( 0.456065)
36
+ 100kx [s,100] 0.440000 0.000000 0.440000 ( 0.438470)
37
+
38
+ array reference
39
+ 100kx [index] 0.020000 0.000000 0.020000 ( 0.026224)
40
+ 100kx [range] 0.080000 0.000000 0.080000 ( 0.079051)
41
+ 100kx [s,1] 0.050000 0.000000 0.050000 ( 0.049507)
42
+ 100kx [s,100] 0.050000 0.000000 0.050000 ( 0.050872)
43
+
44
+ ..............
45
+ Finished in 135.398082 seconds.
@@ -0,0 +1,91 @@
1
+ #######################################
2
+ # reworked osx
3
+ #######################################
4
+ test_element_reference_speed
5
+ user system total real
6
+ I
7
+ 100kx [index] 1.950000 0.660000 2.610000 ( 2.658425)
8
+ 100kx [range] 2.880000 0.650000 3.530000 ( 3.573627)
9
+ 100kx [s,1] 2.100000 0.640000 2.740000 ( 2.774918)
10
+ 100kx [s,100] 20.810000 0.700000 21.510000 ( 21.615324)
11
+
12
+ IIIIIIIIII
13
+ 100kx [index] 1.630000 0.360000 1.990000 ( 1.995421)
14
+ 100kx [range] 1.140000 0.000000 1.140000 ( 1.145692)
15
+ 100kx [s,1] 0.470000 0.000000 0.470000 ( 0.472543)
16
+ 100kx [s,100] 0.470000 0.000000 0.470000 ( 0.472698)
17
+
18
+ array reference
19
+ 100kx [index] 0.030000 0.000000 0.030000 ( 0.026341)
20
+ 100kx [range] 0.060000 0.000000 0.060000 ( 0.060080)
21
+ 100kx [s,1] 0.050000 0.000000 0.050000 ( 0.052237)
22
+ 100kx [s,100] 0.040000 0.000000 0.040000 ( 0.042142)
23
+
24
+ #######################################
25
+ # reworked osx accelerated
26
+ #######################################
27
+ test_element_reference_speed
28
+ user system total real
29
+ I
30
+ 100kx [index] 1.970000 0.650000 2.620000 ( 2.677882)
31
+ 100kx [range] 2.870000 0.650000 3.520000 ( 3.530610)
32
+ 100kx [s,1] 2.130000 0.640000 2.770000 ( 2.777566)
33
+ 100kx [s,100] 8.410000 0.670000 9.080000 ( 9.118457)
34
+
35
+ IIIIIIIIII
36
+ 100kx [index] 1.630000 0.360000 1.990000 ( 2.001829)
37
+ 100kx [range] 1.150000 0.010000 1.160000 ( 1.157869)
38
+ 100kx [s,1] 0.470000 0.000000 0.470000 ( 0.477857)
39
+ 100kx [s,100] 0.470000 0.000000 0.470000 ( 0.476172)
40
+
41
+ array reference
42
+ 100kx [index] 0.020000 0.000000 0.020000 ( 0.026329)
43
+ 100kx [range] 0.060000 0.000000 0.060000 ( 0.060740)
44
+ 100kx [s,1] 0.050000 0.000000 0.050000 ( 0.051872)
45
+ 100kx [s,100] 0.040000 0.000000 0.040000 ( 0.043028)
46
+
47
+ ..............................................................p. ..
48
+
49
+ #####################################
50
+ # with bulk processing only
51
+ #####################################
52
+ ...........F..
53
+ test_element_assignment_speed
54
+ user system total real
55
+ I
56
+ 10kx [index]= 0.190000 0.060000 0.250000 ( 0.278135)
57
+ 10kx [range]= 12.760000 12.470000 25.230000 ( 40.200132)
58
+ 10kx [s,1]= 12.740000 12.360000 25.100000 ( 40.450334)
59
+
60
+ IIIIIIIIII
61
+ 10kx [index]= 0.240000 0.050000 0.290000 ( 0.287169)
62
+ 10kx [range]= 12.410000 13.020000 25.430000 ( 40.168660)
63
+ 10kx [s,1]= 12.510000 13.070000 25.580000 ( 40.690157)
64
+
65
+ array reference
66
+ 10kx [index]= 0.000000 0.000000 0.000000 ( 0.003034)
67
+ 10kx [range]= 0.010000 0.000000 0.010000 ( 0.007231)
68
+ 10kx [s,1]= 0.000000 0.000000 0.000000 ( 0.005260)
69
+
70
+ .
71
+ test_element_reference_speed
72
+ user system total real
73
+ I
74
+ 100kx [index] 1.740000 0.670000 2.410000 ( 2.414568)
75
+ 100kx [range] 2.510000 0.660000 3.170000 ( 3.183513)
76
+ 100kx [s,1] 1.920000 0.680000 2.600000 ( 3.314087)
77
+ 100kx [s,100] 11.460000 0.730000 12.190000 ( 12.384289)
78
+
79
+ IIIIIIIIII
80
+ 100kx [index] 1.420000 0.360000 1.780000 ( 1.785599)
81
+ 100kx [range] 0.870000 0.000000 0.870000 ( 0.875749)
82
+ 100kx [s,1] 0.330000 0.000000 0.330000 ( 0.326366)
83
+ 100kx [s,100] 0.300000 0.000000 0.300000 ( 0.304128)
84
+
85
+ array reference
86
+ 100kx [index] 0.030000 0.000000 0.030000 ( 0.025789)
87
+ 100kx [range] 0.060000 0.000000 0.060000 ( 0.060912)
88
+ 100kx [s,1] 0.040000 0.000000 0.040000 ( 0.042461)
89
+ 100kx [s,100] 0.050000 0.000000 0.050000 ( 0.051094)
90
+
91
+ ..................................F...
@@ -0,0 +1,147 @@
1
+ ##########################################
2
+ # OSX before ASET optimizations
3
+ ##########################################
4
+
5
+ test_array_methods
6
+ user system total real
7
+ 1M << 0.290000 0.010000 0.300000 ( 0.300562)
8
+ 1M [] 0.310000 0.000000 0.310000 ( 0.302214)
9
+ ....
10
+ test_read_from_open_file
11
+ user system total real
12
+ 1kx read from file 0.040000 0.200000 0.240000 ( 0.519244)
13
+ 1kx file.read 0.140000 0.250000 0.390000 ( 0.395224)
14
+ .
15
+ test_read_in_chunk_vs_read_in_pieces
16
+ user system total real
17
+ 1kx read in chunk 0.220000 0.160000 0.380000 ( 0.515190)
18
+ 1kx read in pieces 0.620000 0.110000 0.730000 ( 0.728748)
19
+ 1kx read in one block 0.050000 0.110000 0.160000 ( 0.160819)
20
+ 1kx read in blocks 0.390000 0.110000 0.500000 ( 0.495172)
21
+ 1kx File.read 0.160000 0.270000 0.430000 ( 0.438735)
22
+ .
23
+ test_read_into_arrays
24
+ user system total real
25
+ 100x unpack to array 0.310000 0.030000 0.340000 ( 0.346243)
26
+ 100x File.read.unpack 0.940000 0.060000 1.000000 ( 1.022879)
27
+ ...
28
+ test_unpack_speed
29
+ user system total real
30
+ 100x unpack 0.300000 0.000000 0.300000 ( 0.313970)
31
+ 100x str.unpack 0.930000 0.020000 0.950000 ( 0.960535)
32
+ ............................
33
+ test_element_assignment_speed_for_index
34
+ user system total real
35
+ I
36
+ 1kx [index]= 0.010000 0.000000 0.010000 ( 0.011112)
37
+ 1kx [range]= 0.020000 0.000000 0.020000 ( 0.014436)
38
+ 1kx [s,1]= 0.000000 0.000000 0.000000 ( 0.007936)
39
+
40
+ IIIIIIIIII
41
+ 1kx [index]= 0.010000 0.000000 0.010000 ( 0.012760)
42
+ 1kx [range]= 0.020000 0.000000 0.020000 ( 0.014060)
43
+ 1kx [s,1]= 0.000000 0.000000 0.000000 ( 0.007683)
44
+
45
+ array reference
46
+ 1kx [index]= 0.000000 0.000000 0.000000 ( 0.000359)
47
+ 1kx [range]= 0.010000 0.000000 0.010000 ( 0.001003)
48
+ 1kx [s,1]= 0.000000 0.000000 0.000000 ( 0.000532)
49
+
50
+ .
51
+ test_element_reference_speed_for_index
52
+ user system total real
53
+ I
54
+ 100kx [index] 0.170000 0.000000 0.170000 ( 0.170148)
55
+ 100kx [range] 0.200000 0.000000 0.200000 ( 0.207506)
56
+ 100kx [s,1] 0.210000 0.000000 0.210000 ( 0.206175)
57
+ 100kx [s,10] 0.190000 0.000000 0.190000 ( 0.196211)
58
+ 100kx [s,100] 0.210000 0.000000 0.210000 ( 0.207395)
59
+
60
+ IIIIIIIIII
61
+ 100kx [index] 0.170000 0.000000 0.170000 ( 0.171383)
62
+ 100kx [range] 0.220000 0.000000 0.220000 ( 0.218904)
63
+ 100kx [s,1] 0.220000 0.000000 0.220000 ( 0.217726)
64
+ 100kx [s,10] 0.220000 0.000000 0.220000 ( 0.227541)
65
+ 100kx [s,100] 0.230000 0.010000 0.240000 ( 0.239500)
66
+
67
+ array reference
68
+ 100kx [index] 0.030000 0.000000 0.030000 ( 0.026727)
69
+ 100kx [range] 0.060000 0.000000 0.060000 ( 0.062518)
70
+ 100kx [s,1] 0.040000 0.000000 0.040000 ( 0.043396)
71
+ 100kx [s,10] 0.040000 0.000000 0.040000 ( 0.043224)
72
+ 100kx [s,100] 0.040000 0.000000 0.040000 ( 0.043834)
73
+
74
+ ................................................................
75
+ test_element_assignment_speed_for_ext_arr
76
+ user system total real
77
+
78
+ 1kx [index]= 0.120000 0.010000 0.130000 ( 0.120187)
79
+ 1kx [range]= 0.080000 0.000000 0.080000 ( 0.082323)
80
+ 1kx [s,1]= 0.110000 0.010000 0.120000 ( 0.117434)
81
+
82
+ array reference
83
+ 1kx [index]= 0.110000 0.000000 0.110000 ( 0.118859)
84
+ 1kx [range]= 0.080000 0.010000 0.090000 ( 0.082343)
85
+ 1kx [s,1]= 0.110000 0.010000 0.120000 ( 0.116168)
86
+
87
+ .
88
+ test_element_reference_speed_for_ext_arr
89
+ user system total real
90
+
91
+ 10kx [index] 0.320000 0.130000 0.450000 ( 0.445001)
92
+ 10kx [range] 0.450000 0.110000 0.560000 ( 0.567785)
93
+ 10kx [s,1] 0.310000 0.070000 0.380000 ( 0.391895)
94
+ 10kx [s,10] 2.490000 0.150000 2.640000 ( 2.669212)
95
+
96
+ array reference
97
+ 10kx [index] 0.000000 0.000000 0.000000 ( 0.002583)
98
+ 10kx [range] 0.010000 0.000000 0.010000 ( 0.004749)
99
+ 10kx [s,1] 0.000000 0.000000 0.000000 ( 0.006787)
100
+ 10kx [s,10] 0.000000 0.000000 0.000000 ( 0.003268)
101
+
102
+ ....................................
103
+ test_element_assignment_speed_for_index
104
+ user system total real
105
+ I
106
+ 1kx [index]= 0.020000 0.010000 0.030000 ( 0.026291)
107
+ 1kx [range]= 5.400000 1.410000 6.810000 ( 8.220439)
108
+ 1kx [s,1]= 5.620000 1.410000 7.030000 ( 8.293661)
109
+
110
+ IIIIIIIIII
111
+ 1kx [index]= 0.020000 0.010000 0.030000 ( 0.029998)
112
+ 1kx [range]= 5.880000 1.480000 7.360000 ( 8.588676)
113
+ 1kx [s,1]= 5.580000 1.470000 7.050000 ( 8.308494)
114
+
115
+ array reference
116
+ 1kx [index]= 0.000000 0.000000 0.000000 ( 0.000329)
117
+ 1kx [range]= 0.000000 0.000000 0.000000 ( 0.000700)
118
+ 1kx [s,1]= 0.000000 0.000000 0.000000 ( 0.000570)
119
+
120
+ .
121
+ test_element_reference_speed_for_index
122
+ user system total real
123
+ I
124
+ 100kx [index] 1.950000 0.640000 2.590000 ( 2.598391)
125
+ 100kx [range] 3.130000 0.650000 3.780000 ( 3.786401)
126
+ 100kx [s,1] 2.390000 0.640000 3.030000 ( 3.029791)
127
+ 100kx [s,10] 3.410000 0.650000 4.060000 ( 4.059696)
128
+ 100kx [s,100] 11.250000 0.670000 11.920000 ( 11.970536)
129
+
130
+ IIIIIIIIII
131
+ 100kx [index] 1.610000 0.360000 1.970000 ( 1.972972)
132
+ 100kx [range] 1.070000 0.010000 1.080000 ( 1.080418)
133
+ 100kx [s,1] 0.380000 0.000000 0.380000 ( 0.382648)
134
+ 100kx [s,10] 0.380000 0.000000 0.380000 ( 0.383150)
135
+ 100kx [s,100] 0.440000 0.000000 0.440000 ( 0.439358)
136
+
137
+ array reference
138
+ 100kx [index] 0.020000 0.000000 0.020000 ( 0.026210)
139
+ 100kx [range] 0.050000 0.000000 0.050000 ( 0.050129)
140
+ 100kx [s,1] 0.040000 0.000000 0.040000 ( 0.033032)
141
+ 100kx [s,10] 0.050000 0.000000 0.050000 ( 0.055461)
142
+ 100kx [s,100] 0.040000 0.000000 0.040000 ( 0.032775)
143
+
144
+ .........................................................................p. ..
145
+ Finished in 82.428089 seconds.
146
+
147
+ 216 tests, 5189 assertions, 0 failures, 0 errors