polyphony 1.0.1 → 1.0.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.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/TODO.md +4 -0
  4. data/examples/core/debug.rb +12 -0
  5. data/examples/core/rpc_benchmark.rb +136 -0
  6. data/lib/polyphony/extensions/fiber.rb +1 -0
  7. data/lib/polyphony/extensions/socket.rb +42 -42
  8. data/lib/polyphony/version.rb +1 -1
  9. data/polyphony.gemspec +3 -1
  10. data/test/test_socket.rb +1 -1
  11. metadata +32 -149
  12. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +0 -1
  13. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +0 -1
  14. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +0 -1
  15. data/vendor/liburing/man/io_uring.7 +0 -781
  16. data/vendor/liburing/man/io_uring_buf_ring_add.3 +0 -53
  17. data/vendor/liburing/man/io_uring_buf_ring_advance.3 +0 -31
  18. data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +0 -41
  19. data/vendor/liburing/man/io_uring_buf_ring_init.3 +0 -30
  20. data/vendor/liburing/man/io_uring_buf_ring_mask.3 +0 -27
  21. data/vendor/liburing/man/io_uring_check_version.3 +0 -72
  22. data/vendor/liburing/man/io_uring_close_ring_fd.3 +0 -43
  23. data/vendor/liburing/man/io_uring_cq_advance.3 +0 -49
  24. data/vendor/liburing/man/io_uring_cq_has_overflow.3 +0 -25
  25. data/vendor/liburing/man/io_uring_cq_ready.3 +0 -26
  26. data/vendor/liburing/man/io_uring_cqe_get_data.3 +0 -53
  27. data/vendor/liburing/man/io_uring_cqe_get_data64.3 +0 -1
  28. data/vendor/liburing/man/io_uring_cqe_seen.3 +0 -42
  29. data/vendor/liburing/man/io_uring_enter.2 +0 -1700
  30. data/vendor/liburing/man/io_uring_enter2.2 +0 -1
  31. data/vendor/liburing/man/io_uring_free_probe.3 +0 -27
  32. data/vendor/liburing/man/io_uring_get_events.3 +0 -33
  33. data/vendor/liburing/man/io_uring_get_probe.3 +0 -30
  34. data/vendor/liburing/man/io_uring_get_sqe.3 +0 -57
  35. data/vendor/liburing/man/io_uring_major_version.3 +0 -1
  36. data/vendor/liburing/man/io_uring_minor_version.3 +0 -1
  37. data/vendor/liburing/man/io_uring_opcode_supported.3 +0 -30
  38. data/vendor/liburing/man/io_uring_peek_cqe.3 +0 -38
  39. data/vendor/liburing/man/io_uring_prep_accept.3 +0 -197
  40. data/vendor/liburing/man/io_uring_prep_accept_direct.3 +0 -1
  41. data/vendor/liburing/man/io_uring_prep_cancel.3 +0 -118
  42. data/vendor/liburing/man/io_uring_prep_cancel64.3 +0 -1
  43. data/vendor/liburing/man/io_uring_prep_close.3 +0 -59
  44. data/vendor/liburing/man/io_uring_prep_close_direct.3 +0 -1
  45. data/vendor/liburing/man/io_uring_prep_connect.3 +0 -66
  46. data/vendor/liburing/man/io_uring_prep_fadvise.3 +0 -59
  47. data/vendor/liburing/man/io_uring_prep_fallocate.3 +0 -59
  48. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +0 -1
  49. data/vendor/liburing/man/io_uring_prep_files_update.3 +0 -92
  50. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +0 -1
  51. data/vendor/liburing/man/io_uring_prep_fsync.3 +0 -70
  52. data/vendor/liburing/man/io_uring_prep_getxattr.3 +0 -61
  53. data/vendor/liburing/man/io_uring_prep_link.3 +0 -1
  54. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +0 -94
  55. data/vendor/liburing/man/io_uring_prep_linkat.3 +0 -91
  56. data/vendor/liburing/man/io_uring_prep_madvise.3 +0 -56
  57. data/vendor/liburing/man/io_uring_prep_mkdir.3 +0 -1
  58. data/vendor/liburing/man/io_uring_prep_mkdirat.3 +0 -83
  59. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +0 -92
  60. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +0 -1
  61. data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +0 -1
  62. data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +0 -1
  63. data/vendor/liburing/man/io_uring_prep_nop.3 +0 -28
  64. data/vendor/liburing/man/io_uring_prep_openat.3 +0 -117
  65. data/vendor/liburing/man/io_uring_prep_openat2.3 +0 -117
  66. data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +0 -1
  67. data/vendor/liburing/man/io_uring_prep_openat_direct.3 +0 -1
  68. data/vendor/liburing/man/io_uring_prep_poll_add.3 +0 -72
  69. data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +0 -1
  70. data/vendor/liburing/man/io_uring_prep_poll_remove.3 +0 -55
  71. data/vendor/liburing/man/io_uring_prep_poll_update.3 +0 -89
  72. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +0 -140
  73. data/vendor/liburing/man/io_uring_prep_read.3 +0 -69
  74. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +0 -72
  75. data/vendor/liburing/man/io_uring_prep_readv.3 +0 -85
  76. data/vendor/liburing/man/io_uring_prep_readv2.3 +0 -111
  77. data/vendor/liburing/man/io_uring_prep_recv.3 +0 -105
  78. data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +0 -1
  79. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +0 -124
  80. data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +0 -1
  81. data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +0 -52
  82. data/vendor/liburing/man/io_uring_prep_rename.3 +0 -1
  83. data/vendor/liburing/man/io_uring_prep_renameat.3 +0 -96
  84. data/vendor/liburing/man/io_uring_prep_send.3 +0 -66
  85. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +0 -38
  86. data/vendor/liburing/man/io_uring_prep_send_zc.3 +0 -96
  87. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +0 -1
  88. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +0 -89
  89. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +0 -1
  90. data/vendor/liburing/man/io_uring_prep_setxattr.3 +0 -64
  91. data/vendor/liburing/man/io_uring_prep_shutdown.3 +0 -53
  92. data/vendor/liburing/man/io_uring_prep_socket.3 +0 -118
  93. data/vendor/liburing/man/io_uring_prep_socket_direct.3 +0 -1
  94. data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +0 -1
  95. data/vendor/liburing/man/io_uring_prep_splice.3 +0 -120
  96. data/vendor/liburing/man/io_uring_prep_statx.3 +0 -74
  97. data/vendor/liburing/man/io_uring_prep_symlink.3 +0 -1
  98. data/vendor/liburing/man/io_uring_prep_symlinkat.3 +0 -85
  99. data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +0 -59
  100. data/vendor/liburing/man/io_uring_prep_tee.3 +0 -74
  101. data/vendor/liburing/man/io_uring_prep_timeout.3 +0 -95
  102. data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +0 -1
  103. data/vendor/liburing/man/io_uring_prep_timeout_update.3 +0 -98
  104. data/vendor/liburing/man/io_uring_prep_unlink.3 +0 -1
  105. data/vendor/liburing/man/io_uring_prep_unlinkat.3 +0 -82
  106. data/vendor/liburing/man/io_uring_prep_write.3 +0 -67
  107. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +0 -72
  108. data/vendor/liburing/man/io_uring_prep_writev.3 +0 -85
  109. data/vendor/liburing/man/io_uring_prep_writev2.3 +0 -111
  110. data/vendor/liburing/man/io_uring_queue_exit.3 +0 -26
  111. data/vendor/liburing/man/io_uring_queue_init.3 +0 -89
  112. data/vendor/liburing/man/io_uring_queue_init_params.3 +0 -1
  113. data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +0 -1
  114. data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +0 -1
  115. data/vendor/liburing/man/io_uring_recvmsg_name.3 +0 -1
  116. data/vendor/liburing/man/io_uring_recvmsg_out.3 +0 -82
  117. data/vendor/liburing/man/io_uring_recvmsg_payload.3 +0 -1
  118. data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +0 -1
  119. data/vendor/liburing/man/io_uring_recvmsg_validate.3 +0 -1
  120. data/vendor/liburing/man/io_uring_register.2 +0 -834
  121. data/vendor/liburing/man/io_uring_register_buf_ring.3 +0 -140
  122. data/vendor/liburing/man/io_uring_register_buffers.3 +0 -104
  123. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +0 -1
  124. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +0 -1
  125. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +0 -1
  126. data/vendor/liburing/man/io_uring_register_eventfd.3 +0 -51
  127. data/vendor/liburing/man/io_uring_register_eventfd_async.3 +0 -1
  128. data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +0 -52
  129. data/vendor/liburing/man/io_uring_register_files.3 +0 -112
  130. data/vendor/liburing/man/io_uring_register_files_sparse.3 +0 -1
  131. data/vendor/liburing/man/io_uring_register_files_tags.3 +0 -1
  132. data/vendor/liburing/man/io_uring_register_files_update.3 +0 -1
  133. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +0 -1
  134. data/vendor/liburing/man/io_uring_register_iowq_aff.3 +0 -61
  135. data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +0 -71
  136. data/vendor/liburing/man/io_uring_register_ring_fd.3 +0 -49
  137. data/vendor/liburing/man/io_uring_register_sync_cancel.3 +0 -71
  138. data/vendor/liburing/man/io_uring_setup.2 +0 -669
  139. data/vendor/liburing/man/io_uring_sq_ready.3 +0 -31
  140. data/vendor/liburing/man/io_uring_sq_space_left.3 +0 -25
  141. data/vendor/liburing/man/io_uring_sqe_set_data.3 +0 -48
  142. data/vendor/liburing/man/io_uring_sqe_set_data64.3 +0 -1
  143. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +0 -87
  144. data/vendor/liburing/man/io_uring_sqring_wait.3 +0 -34
  145. data/vendor/liburing/man/io_uring_submit.3 +0 -46
  146. data/vendor/liburing/man/io_uring_submit_and_get_events.3 +0 -31
  147. data/vendor/liburing/man/io_uring_submit_and_wait.3 +0 -38
  148. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +0 -56
  149. data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +0 -30
  150. data/vendor/liburing/man/io_uring_unregister_buffers.3 +0 -27
  151. data/vendor/liburing/man/io_uring_unregister_eventfd.3 +0 -1
  152. data/vendor/liburing/man/io_uring_unregister_files.3 +0 -27
  153. data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +0 -1
  154. data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +0 -32
  155. data/vendor/liburing/man/io_uring_wait_cqe.3 +0 -40
  156. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +0 -43
  157. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +0 -53
  158. data/vendor/liburing/man/io_uring_wait_cqes.3 +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f60a881ccb01cfce59bb3c84420bba574c2b1cd502df987b958a02b649fb4415
4
- data.tar.gz: a138759174aba3944ca5e4faedff676d9c9807a50907ee03d18b2cec50f625c5
3
+ metadata.gz: '09f35eaafb1ff569e8a36e1b1e2350e52ce3048b814fb8ccca935ed1a45d1dbd'
4
+ data.tar.gz: 0e2296097fdb1d6604c6a41a08880d0cab62052cab4b1b4ebe2ac2ce92bbb737
5
5
  SHA512:
6
- metadata.gz: 8167c82b2ebd31f4625dac5cbcf70a610b8e45d062b0ef5d4e2044493b6c9ca25a68b67d8b6948ece9ed3a414f2977c4f72175ce0fc63ce58545acc721f09d73
7
- data.tar.gz: b91049699af9824aeb2fa051d859f35ff0f1b4ba289b7ea143a347a5ad8a882ec5a4fb42502742b3e4d19bf295f9a1d5bf3a9e15f38a061efdcf50a1741f0bce
6
+ metadata.gz: 80004fb81f991c8cca2c65bf89ed642f90f0e4947a47ea7ac34b59200aebc28e5a73215e8c80e837cd22edf92cf8026332a7df4722a5f5555956648ad5e8c9ee
7
+ data.tar.gz: 3eb8022b4fab6b344b422de7791260b1036bd147f7ad8f9a4942e398f0071d8c3468ece6f7d576bb167b4333477643fe1e1b3348601d6fb9db164d8d49775328
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.2 2023-05-28
2
+
3
+ - Remove liburing man files from gemspec (#103)
4
+
1
5
  ## 1.0.1 2023-05-14
2
6
 
3
7
  - Add cheat-sheet
data/TODO.md CHANGED
@@ -1,3 +1,7 @@
1
+ - issue #102 - test and see what this is about
2
+ - Look at RPC benchmark more closely: is there a way to reduce the overhead of
3
+ the `backend_base_switch_fiber` function?
4
+
1
5
  - io_uring backend:
2
6
  - if `io_uring_get_sqe` returns null, call `io_uring_submit`, (snooze fiber)?
3
7
  and try again
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'debug'
5
+ require 'polyphony'
6
+
7
+ puts 'starting'
8
+ binding.break
9
+ sleep 1
10
+ puts 'hello'
11
+ sleep 1
12
+ puts 'bye'
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'polyphony'
5
+ require "benchmark/ips"
6
+
7
+ class Fiber
8
+ def call(*a, **b)
9
+ self << [Fiber.current, a, b]
10
+ Fiber.current.receive
11
+ end
12
+
13
+ def respond
14
+ peer, a, b = receive
15
+ result = yield(*a, **b)
16
+ (peer << result) rescue nil
17
+ rescue
18
+ peer.raise(result)
19
+ end
20
+
21
+ def respond_loop(&b)
22
+ while true
23
+ respond(&b)
24
+ end
25
+ end
26
+ end
27
+
28
+ $server = spin do
29
+ Fiber.current.respond_loop do |x, y|
30
+ x * y
31
+ end
32
+ end
33
+
34
+ $server_optimized = spin do
35
+ while true
36
+ fiber, x, y = receive
37
+ fiber << (x * y)
38
+ end
39
+ end
40
+
41
+ peer = Fiber.current
42
+ $server_single = spin do
43
+ while true
44
+ x = receive
45
+ peer << x * 4
46
+ end
47
+ end
48
+
49
+ $server_schedule = spin do
50
+ while true
51
+ x = suspend
52
+ peer.schedule x * 4
53
+ end
54
+ end
55
+
56
+ $server_raw = Fiber.new do |x|
57
+ while true
58
+ x = peer.transfer x * 4
59
+ end
60
+ end
61
+
62
+ def calc(x, y)
63
+ x * y
64
+ end
65
+
66
+ def bm_raw
67
+ calc(3, 4)
68
+ end
69
+
70
+ def bm_send
71
+ send(:calc, 3, 4)
72
+ end
73
+
74
+ def bm_fiber
75
+ $server.call(3, 4)
76
+ end
77
+
78
+ def bm_fiber_optimized
79
+ $server_optimized << [Fiber.current, 3, 4]
80
+ receive
81
+ end
82
+
83
+ def bm_fiber_single
84
+ $server_single << 3
85
+ receive
86
+ end
87
+
88
+ def bm_fiber_schedule
89
+ $server_schedule.schedule(3)
90
+ suspend
91
+ end
92
+
93
+ def bm_fiber_raw
94
+ $server_raw.transfer 3
95
+ end
96
+
97
+ p bm_raw
98
+ p bm_send
99
+ p bm_fiber
100
+ p bm_fiber_optimized
101
+ p bm_fiber_single
102
+ p bm_fiber_raw
103
+ p bm_fiber_schedule
104
+
105
+ def warmup_jit
106
+ 10000.times do
107
+ bm_raw
108
+ bm_send
109
+ bm_fiber
110
+ bm_fiber_optimized
111
+ bm_fiber_single
112
+ bm_fiber_raw
113
+ bm_fiber_schedule
114
+ end
115
+ end
116
+
117
+ puts "warming up JIT..."
118
+
119
+ 3.times do
120
+ warmup_jit
121
+ sleep 1
122
+ end
123
+
124
+ Benchmark.ips do |x|
125
+ x.report("raw") { bm_raw }
126
+ x.report("send") { bm_send }
127
+ x.report("fiber") { bm_fiber }
128
+ x.report("fiber_optimized") { bm_fiber_optimized }
129
+ x.report("fiber_single") { bm_fiber_single }
130
+ x.report("fiber_raw") { bm_fiber_raw }
131
+ x.report("fiber_schedule") { bm_fiber_schedule }
132
+ x.compare!
133
+ end
134
+
135
+ # p call_result: server.call(3, 4)
136
+
@@ -89,6 +89,7 @@ class ::Fiber
89
89
  self
90
90
  end
91
91
  alias_method :stop, :interrupt
92
+ alias_method :kill, :interrupt
92
93
  alias_method :move_on, :interrupt
93
94
 
94
95
  # Restarts the fiber, with the given value serving as the first value passed
@@ -69,24 +69,24 @@ class ::Socket < ::BasicSocket
69
69
  # If no bytes are available and `EOF` is not hit, this method will block until
70
70
  # the socket is ready to read from.
71
71
  #
72
- # @param maxlen [Integer, nil] maximum bytes to read from socket
72
+ # @param len [Integer, nil] maximum bytes to read from socket
73
73
  # @param buf [String, nil] buffer to read into
74
74
  # @param buf_pos [Number] buffer position to read into
75
75
  # @return [String] buffer used for reading
76
- def read(maxlen = nil, buf = nil, buf_pos = 0)
77
- return Polyphony.backend_recv(self, buf, maxlen, buf_pos) if buf
78
- return Polyphony.backend_recv(self, +'', maxlen, 0) if maxlen
79
-
80
- buf = +''
81
- len = buf.bytesize
82
- while true
83
- Polyphony.backend_recv(self, buf, maxlen || 4096, -1)
84
- new_len = buf.bytesize
85
- break if new_len == len
86
-
87
- len = new_len
76
+ def read(len = nil, buf = nil, buf_pos = 0)
77
+ return '' if len == 0
78
+
79
+ if buf
80
+ return Polyphony.backend_read(self, buf, len, true, buf_pos)
88
81
  end
89
- buf
82
+
83
+ @read_buffer ||= +''
84
+ result = Polyphony.backend_read(self, @read_buffer, len, true, -1)
85
+ return nil unless result
86
+
87
+ already_read = @read_buffer
88
+ @read_buffer = +''
89
+ already_read
90
90
  end
91
91
 
92
92
  # Receives up to `maxlen` bytes from the socket. If `outbuf` is given, it is
@@ -333,24 +333,24 @@ class ::TCPSocket < ::IPSocket
333
333
  # If no bytes are available and `EOF` is not hit, this method will block until
334
334
  # the socket is ready to read from.
335
335
  #
336
- # @param maxlen [Integer, nil] maximum bytes to read from socket
336
+ # @param len [Integer, nil] maximum bytes to read from socket
337
337
  # @param buf [String, nil] buffer to read into
338
338
  # @param buf_pos [Number] buffer position to read into
339
339
  # @return [String] buffer used for reading
340
- def read(maxlen = nil, buf = nil, buf_pos = 0)
341
- return Polyphony.backend_recv(self, buf, maxlen, buf_pos) if buf
342
- return Polyphony.backend_recv(self, +'', maxlen, 0) if maxlen
343
-
344
- buf = +''
345
- len = buf.bytesize
346
- while true
347
- Polyphony.backend_recv(self, buf, maxlen || 4096, -1)
348
- new_len = buf.bytesize
349
- break if new_len == len
350
-
351
- len = new_len
340
+ def read(len = nil, buf = nil, buf_pos = 0)
341
+ return '' if len == 0
342
+
343
+ if buf
344
+ return Polyphony.backend_read(self, buf, len, true, buf_pos)
352
345
  end
353
- buf
346
+
347
+ @read_buffer ||= +''
348
+ result = Polyphony.backend_read(self, @read_buffer, len, true, -1)
349
+ return nil unless result
350
+
351
+ already_read = @read_buffer
352
+ @read_buffer = +''
353
+ already_read
354
354
  end
355
355
 
356
356
  # Receives up to `maxlen` bytes from the socket. If `outbuf` is given, it is
@@ -542,24 +542,24 @@ class ::UNIXSocket < ::BasicSocket
542
542
  # If no bytes are available and `EOF` is not hit, this method will block until
543
543
  # the socket is ready to read from.
544
544
  #
545
- # @param maxlen [Integer, nil] maximum bytes to read from socket
545
+ # @param len [Integer, nil] maximum bytes to read from socket
546
546
  # @param buf [String, nil] buffer to read into
547
547
  # @param buf_pos [Number] buffer position to read into
548
548
  # @return [String] buffer used for reading
549
- def read(maxlen = nil, buf = nil, buf_pos = 0)
550
- return Polyphony.backend_recv(self, buf, maxlen, buf_pos) if buf
551
- return Polyphony.backend_recv(self, +'', maxlen, 0) if maxlen
552
-
553
- buf = +''
554
- len = buf.bytesize
555
- while true
556
- Polyphony.backend_recv(self, buf, maxlen || 4096, -1)
557
- new_len = buf.bytesize
558
- break if new_len == len
559
-
560
- len = new_len
549
+ def read(len = nil, buf = nil, buf_pos = 0)
550
+ return '' if len == 0
551
+
552
+ if buf
553
+ return Polyphony.backend_read(self, buf, len, true, buf_pos)
561
554
  end
562
- buf
555
+
556
+ @read_buffer ||= +''
557
+ result = Polyphony.backend_read(self, @read_buffer, len, true, -1)
558
+ return nil unless result
559
+
560
+ already_read = @read_buffer
561
+ @read_buffer = +''
562
+ already_read
563
563
  end
564
564
 
565
565
  # Receives up to `maxlen` bytes from the socket. If `outbuf` is given, it is
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Polyphony
4
4
  # @!visibility private
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
data/polyphony.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.summary = 'Fine grained concurrency for Ruby'
8
8
  s.author = 'Sharon Rosner'
9
9
  s.email = 'sharon@noteflakes.com'
10
- s.files = `git ls-files --recurse-submodules`.split
10
+ s.files = `git ls-files --recurse-submodules`.split.reject { |fn| fn =~ /liburing\/man/ }
11
11
  s.homepage = 'https://digital-fabric.github.io/polyphony'
12
12
  s.metadata = {
13
13
  "source_code_uri" => "https://github.com/digital-fabric/polyphony",
@@ -29,4 +29,6 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'msgpack', '1.6.0'
30
30
  s.add_development_dependency 'httparty', '0.21.0'
31
31
  s.add_development_dependency 'localhost', '1.1.10'
32
+ s.add_development_dependency 'debug', '1.8.0'
33
+ s.add_development_dependency 'benchmark-ips', '2.10.0'
32
34
  end
data/test/test_socket.rb CHANGED
@@ -75,7 +75,7 @@ class TCPSocketTest < MiniTest::Test
75
75
  server_fiber = spin do
76
76
  while (socket = server.accept)
77
77
  spin do
78
- while (data = socket.read(8192))
78
+ while (data = socket.readpartial(8192))
79
79
  socket << data
80
80
  end
81
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyphony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-14 00:00:00.000000000 Z
11
+ date: 2023-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -122,6 +122,34 @@ dependencies:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.1.10
125
+ - !ruby/object:Gem::Dependency
126
+ name: debug
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.8.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 1.8.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: benchmark-ips
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 2.10.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 2.10.0
125
153
  description:
126
154
  email: sharon@noteflakes.com
127
155
  executables: []
@@ -182,6 +210,7 @@ files:
182
210
  - examples/core/calc_with_restart.rb
183
211
  - examples/core/calc_with_supervise.rb
184
212
  - examples/core/channels.rb
213
+ - examples/core/debug.rb
185
214
  - examples/core/deferring-an-operation.rb
186
215
  - examples/core/enumerable.rb
187
216
  - examples/core/erlang-style-genserver.rb
@@ -198,6 +227,7 @@ files:
198
227
  - examples/core/recurrent-timer.rb
199
228
  - examples/core/resource_delegate.rb
200
229
  - examples/core/ring.rb
230
+ - examples/core/rpc_benchmark.rb
201
231
  - examples/core/shutdown_all_children.rb
202
232
  - examples/core/spin.rb
203
233
  - examples/core/spin_error_backtrace.rb
@@ -425,153 +455,6 @@ files:
425
455
  - vendor/liburing/liburing.pc.in
426
456
  - vendor/liburing/liburing.spec
427
457
  - vendor/liburing/make-debs.sh
428
- - vendor/liburing/man/IO_URING_CHECK_VERSION.3
429
- - vendor/liburing/man/IO_URING_VERSION_MAJOR.3
430
- - vendor/liburing/man/IO_URING_VERSION_MINOR.3
431
- - vendor/liburing/man/io_uring.7
432
- - vendor/liburing/man/io_uring_buf_ring_add.3
433
- - vendor/liburing/man/io_uring_buf_ring_advance.3
434
- - vendor/liburing/man/io_uring_buf_ring_cq_advance.3
435
- - vendor/liburing/man/io_uring_buf_ring_init.3
436
- - vendor/liburing/man/io_uring_buf_ring_mask.3
437
- - vendor/liburing/man/io_uring_check_version.3
438
- - vendor/liburing/man/io_uring_close_ring_fd.3
439
- - vendor/liburing/man/io_uring_cq_advance.3
440
- - vendor/liburing/man/io_uring_cq_has_overflow.3
441
- - vendor/liburing/man/io_uring_cq_ready.3
442
- - vendor/liburing/man/io_uring_cqe_get_data.3
443
- - vendor/liburing/man/io_uring_cqe_get_data64.3
444
- - vendor/liburing/man/io_uring_cqe_seen.3
445
- - vendor/liburing/man/io_uring_enter.2
446
- - vendor/liburing/man/io_uring_enter2.2
447
- - vendor/liburing/man/io_uring_free_probe.3
448
- - vendor/liburing/man/io_uring_get_events.3
449
- - vendor/liburing/man/io_uring_get_probe.3
450
- - vendor/liburing/man/io_uring_get_sqe.3
451
- - vendor/liburing/man/io_uring_major_version.3
452
- - vendor/liburing/man/io_uring_minor_version.3
453
- - vendor/liburing/man/io_uring_opcode_supported.3
454
- - vendor/liburing/man/io_uring_peek_cqe.3
455
- - vendor/liburing/man/io_uring_prep_accept.3
456
- - vendor/liburing/man/io_uring_prep_accept_direct.3
457
- - vendor/liburing/man/io_uring_prep_cancel.3
458
- - vendor/liburing/man/io_uring_prep_cancel64.3
459
- - vendor/liburing/man/io_uring_prep_close.3
460
- - vendor/liburing/man/io_uring_prep_close_direct.3
461
- - vendor/liburing/man/io_uring_prep_connect.3
462
- - vendor/liburing/man/io_uring_prep_fadvise.3
463
- - vendor/liburing/man/io_uring_prep_fallocate.3
464
- - vendor/liburing/man/io_uring_prep_fgetxattr.3
465
- - vendor/liburing/man/io_uring_prep_files_update.3
466
- - vendor/liburing/man/io_uring_prep_fsetxattr.3
467
- - vendor/liburing/man/io_uring_prep_fsync.3
468
- - vendor/liburing/man/io_uring_prep_getxattr.3
469
- - vendor/liburing/man/io_uring_prep_link.3
470
- - vendor/liburing/man/io_uring_prep_link_timeout.3
471
- - vendor/liburing/man/io_uring_prep_linkat.3
472
- - vendor/liburing/man/io_uring_prep_madvise.3
473
- - vendor/liburing/man/io_uring_prep_mkdir.3
474
- - vendor/liburing/man/io_uring_prep_mkdirat.3
475
- - vendor/liburing/man/io_uring_prep_msg_ring.3
476
- - vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3
477
- - vendor/liburing/man/io_uring_prep_multishot_accept.3
478
- - vendor/liburing/man/io_uring_prep_multishot_accept_direct.3
479
- - vendor/liburing/man/io_uring_prep_nop.3
480
- - vendor/liburing/man/io_uring_prep_openat.3
481
- - vendor/liburing/man/io_uring_prep_openat2.3
482
- - vendor/liburing/man/io_uring_prep_openat2_direct.3
483
- - vendor/liburing/man/io_uring_prep_openat_direct.3
484
- - vendor/liburing/man/io_uring_prep_poll_add.3
485
- - vendor/liburing/man/io_uring_prep_poll_multishot.3
486
- - vendor/liburing/man/io_uring_prep_poll_remove.3
487
- - vendor/liburing/man/io_uring_prep_poll_update.3
488
- - vendor/liburing/man/io_uring_prep_provide_buffers.3
489
- - vendor/liburing/man/io_uring_prep_read.3
490
- - vendor/liburing/man/io_uring_prep_read_fixed.3
491
- - vendor/liburing/man/io_uring_prep_readv.3
492
- - vendor/liburing/man/io_uring_prep_readv2.3
493
- - vendor/liburing/man/io_uring_prep_recv.3
494
- - vendor/liburing/man/io_uring_prep_recv_multishot.3
495
- - vendor/liburing/man/io_uring_prep_recvmsg.3
496
- - vendor/liburing/man/io_uring_prep_recvmsg_multishot.3
497
- - vendor/liburing/man/io_uring_prep_remove_buffers.3
498
- - vendor/liburing/man/io_uring_prep_rename.3
499
- - vendor/liburing/man/io_uring_prep_renameat.3
500
- - vendor/liburing/man/io_uring_prep_send.3
501
- - vendor/liburing/man/io_uring_prep_send_set_addr.3
502
- - vendor/liburing/man/io_uring_prep_send_zc.3
503
- - vendor/liburing/man/io_uring_prep_send_zc_fixed.3
504
- - vendor/liburing/man/io_uring_prep_sendmsg.3
505
- - vendor/liburing/man/io_uring_prep_sendmsg_zc.3
506
- - vendor/liburing/man/io_uring_prep_setxattr.3
507
- - vendor/liburing/man/io_uring_prep_shutdown.3
508
- - vendor/liburing/man/io_uring_prep_socket.3
509
- - vendor/liburing/man/io_uring_prep_socket_direct.3
510
- - vendor/liburing/man/io_uring_prep_socket_direct_alloc.3
511
- - vendor/liburing/man/io_uring_prep_splice.3
512
- - vendor/liburing/man/io_uring_prep_statx.3
513
- - vendor/liburing/man/io_uring_prep_symlink.3
514
- - vendor/liburing/man/io_uring_prep_symlinkat.3
515
- - vendor/liburing/man/io_uring_prep_sync_file_range.3
516
- - vendor/liburing/man/io_uring_prep_tee.3
517
- - vendor/liburing/man/io_uring_prep_timeout.3
518
- - vendor/liburing/man/io_uring_prep_timeout_remove.3
519
- - vendor/liburing/man/io_uring_prep_timeout_update.3
520
- - vendor/liburing/man/io_uring_prep_unlink.3
521
- - vendor/liburing/man/io_uring_prep_unlinkat.3
522
- - vendor/liburing/man/io_uring_prep_write.3
523
- - vendor/liburing/man/io_uring_prep_write_fixed.3
524
- - vendor/liburing/man/io_uring_prep_writev.3
525
- - vendor/liburing/man/io_uring_prep_writev2.3
526
- - vendor/liburing/man/io_uring_queue_exit.3
527
- - vendor/liburing/man/io_uring_queue_init.3
528
- - vendor/liburing/man/io_uring_queue_init_params.3
529
- - vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3
530
- - vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3
531
- - vendor/liburing/man/io_uring_recvmsg_name.3
532
- - vendor/liburing/man/io_uring_recvmsg_out.3
533
- - vendor/liburing/man/io_uring_recvmsg_payload.3
534
- - vendor/liburing/man/io_uring_recvmsg_payload_length.3
535
- - vendor/liburing/man/io_uring_recvmsg_validate.3
536
- - vendor/liburing/man/io_uring_register.2
537
- - vendor/liburing/man/io_uring_register_buf_ring.3
538
- - vendor/liburing/man/io_uring_register_buffers.3
539
- - vendor/liburing/man/io_uring_register_buffers_sparse.3
540
- - vendor/liburing/man/io_uring_register_buffers_tags.3
541
- - vendor/liburing/man/io_uring_register_buffers_update_tag.3
542
- - vendor/liburing/man/io_uring_register_eventfd.3
543
- - vendor/liburing/man/io_uring_register_eventfd_async.3
544
- - vendor/liburing/man/io_uring_register_file_alloc_range.3
545
- - vendor/liburing/man/io_uring_register_files.3
546
- - vendor/liburing/man/io_uring_register_files_sparse.3
547
- - vendor/liburing/man/io_uring_register_files_tags.3
548
- - vendor/liburing/man/io_uring_register_files_update.3
549
- - vendor/liburing/man/io_uring_register_files_update_tag.3
550
- - vendor/liburing/man/io_uring_register_iowq_aff.3
551
- - vendor/liburing/man/io_uring_register_iowq_max_workers.3
552
- - vendor/liburing/man/io_uring_register_ring_fd.3
553
- - vendor/liburing/man/io_uring_register_sync_cancel.3
554
- - vendor/liburing/man/io_uring_setup.2
555
- - vendor/liburing/man/io_uring_sq_ready.3
556
- - vendor/liburing/man/io_uring_sq_space_left.3
557
- - vendor/liburing/man/io_uring_sqe_set_data.3
558
- - vendor/liburing/man/io_uring_sqe_set_data64.3
559
- - vendor/liburing/man/io_uring_sqe_set_flags.3
560
- - vendor/liburing/man/io_uring_sqring_wait.3
561
- - vendor/liburing/man/io_uring_submit.3
562
- - vendor/liburing/man/io_uring_submit_and_get_events.3
563
- - vendor/liburing/man/io_uring_submit_and_wait.3
564
- - vendor/liburing/man/io_uring_submit_and_wait_timeout.3
565
- - vendor/liburing/man/io_uring_unregister_buf_ring.3
566
- - vendor/liburing/man/io_uring_unregister_buffers.3
567
- - vendor/liburing/man/io_uring_unregister_eventfd.3
568
- - vendor/liburing/man/io_uring_unregister_files.3
569
- - vendor/liburing/man/io_uring_unregister_iowq_aff.3
570
- - vendor/liburing/man/io_uring_unregister_ring_fd.3
571
- - vendor/liburing/man/io_uring_wait_cqe.3
572
- - vendor/liburing/man/io_uring_wait_cqe_nr.3
573
- - vendor/liburing/man/io_uring_wait_cqe_timeout.3
574
- - vendor/liburing/man/io_uring_wait_cqes.3
575
458
  - vendor/liburing/src/Makefile
576
459
  - vendor/liburing/src/arch/aarch64/lib.h
577
460
  - vendor/liburing/src/arch/aarch64/syscall.h
@@ -1 +0,0 @@
1
- io_uring_check_version.3
@@ -1 +0,0 @@
1
- io_uring_check_version.3
@@ -1 +0,0 @@
1
- io_uring_check_version.3