win32-nio 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +2 -0
- data/CHANGES +46 -41
- data/MANIFEST +12 -10
- data/README +86 -86
- data/Rakefile +84 -83
- data/appveyor.yml +45 -0
- data/benchmarks/win32_nio_benchmarks.rb +113 -113
- data/certs/djberg96_pub.pem +21 -0
- data/ext/extconf.rb +2 -2
- data/ext/win32/nio.c +355 -355
- data/test/test_win32_nio_read.rb +79 -79
- data/test/test_win32_nio_readlines.rb +75 -75
- data/win32-nio.gemspec +29 -28
- metadata +37 -8
- metadata.gz.sig +3 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77c6864cd5b2e73814911152bfa2e49e4ff8c88c
|
4
|
+
data.tar.gz: f7f9caebe80964c90536d5bb16a94f5120637af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044a653819623b0f04ffea465486191d7d4c91fdf5924b9ea90ce032d2433184e75a43ed72c70a286b05feb894adba08b94db8c00d5af8e9b476ccc926170113
|
7
|
+
data.tar.gz: 5b5e8ad7859a13d2dd344e05188b6ea522fdcdd2bd0627bc6b68165cefb5d57f30c532f02cf24e44e37bac022db316c2ce29503579dc92666a4608e1fad95b86
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
data/CHANGES
CHANGED
@@ -1,41 +1,46 @@
|
|
1
|
-
== 0.2.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
*
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
*
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
*
|
38
|
-
|
39
|
-
|
40
|
-
== 0.0.
|
41
|
-
*
|
1
|
+
== 0.2.2 - 18-Nov-2015
|
2
|
+
* This gem is now signed.
|
3
|
+
* Added an appveyor.yml file for the MS continuous integration service.
|
4
|
+
* Some Rakefile updates.
|
5
|
+
|
6
|
+
== 0.2.1 - 21-Jun-2015
|
7
|
+
* Fixed some build warnings on mingw32.
|
8
|
+
|
9
|
+
== 0.2.0 - 30-Mar-2015
|
10
|
+
* Converted to C code for performance.
|
11
|
+
* The NIO.readlines method now accepts an optional event object as
|
12
|
+
an argument.
|
13
|
+
* A negative offset value will now raise an ArgumentError.
|
14
|
+
* Some documentation updates.
|
15
|
+
|
16
|
+
== 0.1.3 - 21-Oct-2013
|
17
|
+
* Fixed INVALID_HANDLE_VALUE for 64-bit versions of Ruby.
|
18
|
+
* Added Rake as a development dependency.
|
19
|
+
|
20
|
+
== 0.1.2 - 20-Oct-2013
|
21
|
+
* Fixed the underlying data types for the OVERLAPPED FFI struct. This
|
22
|
+
affected 64-bit versions of Ruby.
|
23
|
+
* Updated gem:create task for Rubygems 2.x.
|
24
|
+
* Removed unnecessary require in test suite.
|
25
|
+
|
26
|
+
== 0.1.1 - 10-Apr-2013
|
27
|
+
* Updated the HANDLE type in the underlying FFI code. This affects
|
28
|
+
64 bit versions of Ruby.
|
29
|
+
|
30
|
+
== 0.1.0 - 12-Jul-2012
|
31
|
+
* Changed from win32-api to FFI.
|
32
|
+
* Now requires Ruby 1.9 or later.
|
33
|
+
|
34
|
+
== 0.0.3 - 24-Apr-2010
|
35
|
+
* Removed inline gem building from the gemspec. That's now handled by a
|
36
|
+
Rakefile task.
|
37
|
+
* Rafactored the Rakefile, removed an old install task and added new
|
38
|
+
gem tasks.
|
39
|
+
|
40
|
+
== 0.0.2 - 6-Aug-2009
|
41
|
+
* License changed to Artistic 2.0.
|
42
|
+
* Some gemspec updates, including adding win32-event as a dependency and
|
43
|
+
test-unit as a development dependency.
|
44
|
+
|
45
|
+
== 0.0.1 - 28-Nov-2008
|
46
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
1
|
+
* appveyor.yml
|
2
|
+
* CHANGES
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* README
|
6
|
+
* win32-nio.gemspec
|
7
|
+
* benchmarks/win32_nio_benchmarks.rb
|
8
|
+
* certs/djberg96_pub.pem
|
9
|
+
* ext/extconf.rb
|
10
|
+
* ext/win32/nio.c
|
11
|
+
* test/test_win32_nio_read.rb
|
12
|
+
* test/test_win32_nio_readlines.rb
|
data/README
CHANGED
@@ -1,86 +1,86 @@
|
|
1
|
-
= Description
|
2
|
-
Native IO for Windows. This class matches and extends the current Ruby
|
3
|
-
IO class API, using native Windows functions underneath the hood.
|
4
|
-
|
5
|
-
= Installation
|
6
|
-
gem install win32-nio
|
7
|
-
|
8
|
-
= Synopsis
|
9
|
-
require 'win32/nio'
|
10
|
-
include Win32
|
11
|
-
|
12
|
-
# Similar to Ruby
|
13
|
-
p NIO.read('some_file.text')
|
14
|
-
p NIO.read('some_file.text', 50)
|
15
|
-
p NIO.read('some_file.text', 50, 5)
|
16
|
-
|
17
|
-
p NIO.readlines('some_file.txt')
|
18
|
-
p NIO.readlines('some_file.txt', '')
|
19
|
-
|
20
|
-
# With events
|
21
|
-
event = Win32::Event.new
|
22
|
-
|
23
|
-
NIO.read('some_big_file.txt', nil, nil, event)
|
24
|
-
p event.signaled? # => true
|
25
|
-
|
26
|
-
# With blocks
|
27
|
-
NIO.read('some_big_file.txt'){ puts "Finished" }
|
28
|
-
|
29
|
-
= Proof of Concept
|
30
|
-
This code was originally written to see if using pure Windows functions
|
31
|
-
to implement MRI methods would offer any practical advantage. The answer
|
32
|
-
is a definite maybe.
|
33
|
-
|
34
|
-
Functionally, this library does offer something the MRI methods do not,
|
35
|
-
which is the ability to provide a block or event object that is called
|
36
|
-
when a read is finished.
|
37
|
-
|
38
|
-
In terms of speed, I've found the NIO.read method to be almost twice as
|
39
|
-
fast as Ruby 2.2, while the NIO.readlines method was about the same speed.
|
40
|
-
In most cases the NIO.readlines method offers no practical advantage, but
|
41
|
-
see the documentation for details.
|
42
|
-
|
43
|
-
= Benchmarks
|
44
|
-
|
45
|
-
Using my current laptop running Windows 7 I saw these results, which were
|
46
|
-
typical in repeated runs:
|
47
|
-
|
48
|
-
IO.read(small) 0.000000 0.016000 0.016000 ( 0.020342)
|
49
|
-
NIO.read(small) 0.000000 0.000000 0.000000 ( 0.008140)
|
50
|
-
IO.read(medium) 0.187000 0.047000 0.234000 ( 0.230579)
|
51
|
-
NIO.read(medium) 0.015000 0.093000 0.108000 ( 0.122542)
|
52
|
-
IO.read(large) 1.654000 0.593000 2.247000 ( 2.355478)
|
53
|
-
NIO.read(large) 0.343000 0.765000 1.108000 ( 1.222567)
|
54
|
-
|
55
|
-
IO.readlines(small) 0.125000 0.000000 0.125000 ( 0.119982)
|
56
|
-
NIO.readlines(small) 0.094000 0.015000 0.109000 ( 0.132461)
|
57
|
-
IO.readlines(medium) 1.419000 0.234000 1.653000 ( 1.764216)
|
58
|
-
NIO.readlines(medium) 1.092000 0.109000 1.201000 ( 1.537593)
|
59
|
-
IO.readlines(large) 12.714000 0.874000 13.588000 ( 13.798494)
|
60
|
-
NIO.readlines(large) 9.719000 0.468000 10.187000 ( 13.437217)
|
61
|
-
|
62
|
-
Your results may vary.
|
63
|
-
|
64
|
-
= JRuby
|
65
|
-
As of version 0.2.0 this code was written as a C extension, and
|
66
|
-
does not support JRuby. However, JRuby users can continue to use
|
67
|
-
the 0.1.x branch.
|
68
|
-
|
69
|
-
= Known Bugs
|
70
|
-
None that I know of. Please log any other bug reports on the RubyForge
|
71
|
-
project page at https://github.com/djberg96/win32-nio.
|
72
|
-
|
73
|
-
= License
|
74
|
-
Artistic 2.0
|
75
|
-
|
76
|
-
= Copyright
|
77
|
-
(C) 2008-2015 Daniel J. Berger, All Rights Reserved
|
78
|
-
|
79
|
-
= Warranty
|
80
|
-
This package is provided "as is" and without any express or
|
81
|
-
implied warranties, including, without limitation, the implied
|
82
|
-
warranties of merchantability and fitness for a particular purpose.
|
83
|
-
|
84
|
-
= Author(s)
|
85
|
-
Daniel Berger
|
86
|
-
Park Heesob
|
1
|
+
= Description
|
2
|
+
Native IO for Windows. This class matches and extends the current Ruby
|
3
|
+
IO class API, using native Windows functions underneath the hood.
|
4
|
+
|
5
|
+
= Installation
|
6
|
+
gem install win32-nio
|
7
|
+
|
8
|
+
= Synopsis
|
9
|
+
require 'win32/nio'
|
10
|
+
include Win32
|
11
|
+
|
12
|
+
# Similar to Ruby
|
13
|
+
p NIO.read('some_file.text')
|
14
|
+
p NIO.read('some_file.text', 50)
|
15
|
+
p NIO.read('some_file.text', 50, 5)
|
16
|
+
|
17
|
+
p NIO.readlines('some_file.txt')
|
18
|
+
p NIO.readlines('some_file.txt', '')
|
19
|
+
|
20
|
+
# With events
|
21
|
+
event = Win32::Event.new
|
22
|
+
|
23
|
+
NIO.read('some_big_file.txt', nil, nil, event)
|
24
|
+
p event.signaled? # => true
|
25
|
+
|
26
|
+
# With blocks
|
27
|
+
NIO.read('some_big_file.txt'){ puts "Finished" }
|
28
|
+
|
29
|
+
= Proof of Concept
|
30
|
+
This code was originally written to see if using pure Windows functions
|
31
|
+
to implement MRI methods would offer any practical advantage. The answer
|
32
|
+
is a definite maybe.
|
33
|
+
|
34
|
+
Functionally, this library does offer something the MRI methods do not,
|
35
|
+
which is the ability to provide a block or event object that is called
|
36
|
+
when a read is finished.
|
37
|
+
|
38
|
+
In terms of speed, I've found the NIO.read method to be almost twice as
|
39
|
+
fast as Ruby 2.2, while the NIO.readlines method was about the same speed.
|
40
|
+
In most cases the NIO.readlines method offers no practical advantage, but
|
41
|
+
see the documentation for details.
|
42
|
+
|
43
|
+
= Benchmarks
|
44
|
+
|
45
|
+
Using my current laptop running Windows 7 I saw these results, which were
|
46
|
+
typical in repeated runs:
|
47
|
+
|
48
|
+
IO.read(small) 0.000000 0.016000 0.016000 ( 0.020342)
|
49
|
+
NIO.read(small) 0.000000 0.000000 0.000000 ( 0.008140)
|
50
|
+
IO.read(medium) 0.187000 0.047000 0.234000 ( 0.230579)
|
51
|
+
NIO.read(medium) 0.015000 0.093000 0.108000 ( 0.122542)
|
52
|
+
IO.read(large) 1.654000 0.593000 2.247000 ( 2.355478)
|
53
|
+
NIO.read(large) 0.343000 0.765000 1.108000 ( 1.222567)
|
54
|
+
|
55
|
+
IO.readlines(small) 0.125000 0.000000 0.125000 ( 0.119982)
|
56
|
+
NIO.readlines(small) 0.094000 0.015000 0.109000 ( 0.132461)
|
57
|
+
IO.readlines(medium) 1.419000 0.234000 1.653000 ( 1.764216)
|
58
|
+
NIO.readlines(medium) 1.092000 0.109000 1.201000 ( 1.537593)
|
59
|
+
IO.readlines(large) 12.714000 0.874000 13.588000 ( 13.798494)
|
60
|
+
NIO.readlines(large) 9.719000 0.468000 10.187000 ( 13.437217)
|
61
|
+
|
62
|
+
Your results may vary.
|
63
|
+
|
64
|
+
= JRuby
|
65
|
+
As of version 0.2.0 this code was written as a C extension, and
|
66
|
+
does not support JRuby. However, JRuby users can continue to use
|
67
|
+
the 0.1.x branch.
|
68
|
+
|
69
|
+
= Known Bugs
|
70
|
+
None that I know of. Please log any other bug reports on the RubyForge
|
71
|
+
project page at https://github.com/djberg96/win32-nio.
|
72
|
+
|
73
|
+
= License
|
74
|
+
Artistic 2.0
|
75
|
+
|
76
|
+
= Copyright
|
77
|
+
(C) 2008-2015 Daniel J. Berger, All Rights Reserved
|
78
|
+
|
79
|
+
= Warranty
|
80
|
+
This package is provided "as is" and without any express or
|
81
|
+
implied warranties, including, without limitation, the implied
|
82
|
+
warranties of merchantability and fitness for a particular purpose.
|
83
|
+
|
84
|
+
= Author(s)
|
85
|
+
Daniel Berger
|
86
|
+
Park Heesob
|
data/Rakefile
CHANGED
@@ -1,83 +1,84 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
include RbConfig
|
5
|
-
|
6
|
-
CLEAN.include(
|
7
|
-
'**/*.gem', # Gem files
|
8
|
-
'**/*.txt', # Benchmark files
|
9
|
-
'**/*.rbc', # Rubinius
|
10
|
-
'**/*.o', # C object file
|
11
|
-
'**/*.log', # Ruby extension build log
|
12
|
-
'**/Makefile', # C Makefile
|
13
|
-
'**/*.def', # Definition files
|
14
|
-
'**/*.exp',
|
15
|
-
'**/*.lib',
|
16
|
-
'**/*.pdb',
|
17
|
-
'**/*.obj',
|
18
|
-
'**/*.stackdump', # Junk that can happen on Windows
|
19
|
-
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
20
|
-
)
|
21
|
-
|
22
|
-
desc "Build the win32-nio library"
|
23
|
-
task :build => [:clean] do
|
24
|
-
if RbConfig::CONFIG['host_os'] =~ /mingw|cygwn/i
|
25
|
-
require 'devkit'
|
26
|
-
make_cmd = "make"
|
27
|
-
else
|
28
|
-
make_cmd = "nmake"
|
29
|
-
end
|
30
|
-
Dir.chdir('ext') do
|
31
|
-
ruby "extconf.rb"
|
32
|
-
sh make_cmd
|
33
|
-
cp 'nio.so', 'win32' # For testing
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
namespace 'gem' do
|
38
|
-
desc 'Create the win32-nio gem'
|
39
|
-
task :create => [:clean] do
|
40
|
-
require 'rubygems/package'
|
41
|
-
spec = eval(IO.read('win32-nio.gemspec'))
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
t.
|
62
|
-
t.
|
63
|
-
t.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
t.
|
70
|
-
t.
|
71
|
-
t.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
t.
|
78
|
-
t.
|
79
|
-
t.
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
include RbConfig
|
5
|
+
|
6
|
+
CLEAN.include(
|
7
|
+
'**/*.gem', # Gem files
|
8
|
+
'**/*.txt', # Benchmark files
|
9
|
+
'**/*.rbc', # Rubinius
|
10
|
+
'**/*.o', # C object file
|
11
|
+
'**/*.log', # Ruby extension build log
|
12
|
+
'**/Makefile', # C Makefile
|
13
|
+
'**/*.def', # Definition files
|
14
|
+
'**/*.exp',
|
15
|
+
'**/*.lib',
|
16
|
+
'**/*.pdb',
|
17
|
+
'**/*.obj',
|
18
|
+
'**/*.stackdump', # Junk that can happen on Windows
|
19
|
+
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
20
|
+
)
|
21
|
+
|
22
|
+
desc "Build the win32-nio library"
|
23
|
+
task :build => [:clean] do
|
24
|
+
if RbConfig::CONFIG['host_os'] =~ /mingw|cygwn/i
|
25
|
+
require 'devkit'
|
26
|
+
make_cmd = "make"
|
27
|
+
else
|
28
|
+
make_cmd = "nmake"
|
29
|
+
end
|
30
|
+
Dir.chdir('ext') do
|
31
|
+
ruby "extconf.rb"
|
32
|
+
sh make_cmd
|
33
|
+
cp 'nio.so', 'win32' # For testing
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace 'gem' do
|
38
|
+
desc 'Create the win32-nio gem'
|
39
|
+
task :create => [:clean] do
|
40
|
+
require 'rubygems/package'
|
41
|
+
spec = eval(IO.read('win32-nio.gemspec'))
|
42
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
43
|
+
Gem::Package.build(spec, true)
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Install the win32-nio gem'
|
47
|
+
task :install => [:create] do
|
48
|
+
file = Dir['*.gem'].first
|
49
|
+
sh "gem install -l #{file}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Run the benchmark suite'
|
54
|
+
task :bench => [:build] do
|
55
|
+
sh "ruby -Iext benchmarks/win32_nio_benchmarks.rb"
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace :test do
|
59
|
+
Rake::TestTask.new(:read) do |t|
|
60
|
+
task :read => [:build]
|
61
|
+
t.libs << 'ext'
|
62
|
+
t.verbose = true
|
63
|
+
t.warning = true
|
64
|
+
t.test_files = FileList['test/test_win32_nio_read.rb']
|
65
|
+
end
|
66
|
+
|
67
|
+
Rake::TestTask.new(:readlines) do |t|
|
68
|
+
task :readlines => [:build]
|
69
|
+
t.libs << 'ext'
|
70
|
+
t.verbose = true
|
71
|
+
t.warning = true
|
72
|
+
t.test_files = FileList['test/test_win32_nio_readlines.rb']
|
73
|
+
end
|
74
|
+
|
75
|
+
Rake::TestTask.new(:all) do |t|
|
76
|
+
task :all => [:build]
|
77
|
+
t.libs << 'ext'
|
78
|
+
t.verbose = true
|
79
|
+
t.warning = true
|
80
|
+
t.test_files = FileList['test/test*.rb']
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
task :default => 'test:all'
|