uringmachine 0.33.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b62f0845e3bc8044bb1a21481d44c231d07a0fa191a92c7d4916ca6005a076
4
- data.tar.gz: 7d2533a8c3c7c1fcc5d03c183a39a7fb789a2f05510cfbdce5bc08d9744969f3
3
+ metadata.gz: 8704dd734601efec57a8bb095c43dc44f752cd01b0cbe04c550fbc321fb2fbfa
4
+ data.tar.gz: 86d5a99e31296951b2fb565bd12a60b64f6ef43ba331c16bb1307d5a27b27971
5
5
  SHA512:
6
- metadata.gz: a3d7b2d5ae670304d8540fd6684c3e2a8548c491866cbd3a2ddf1fb65034517f55b6faa41da4f7a8965d243cd86ae965c3ad3e6cb2d5026097ac36cdf4911d8b
7
- data.tar.gz: 800d1c0fe51d8399aefd799efe3338e060c15a6a072b86b33078696f2920f84e59d138e97dd4518eb71d2a00f7ac7c5dc8860caef3d24a645486946291a09dba
6
+ metadata.gz: e83aece1507a0be85ccbcc7bd229dbe2976fab489a59bb07814e147f51de5a9e526a4a4fbc08ddc5b3b01d96bfd132ad79de40acb58bcfca31eaab2b1516df01
7
+ data.tar.gz: 0d5572ccc1822cf50d9c0d3e1ad0fccb39f80640b753a9962a737a58ca6ea0024cb3342fe3c91d097f4f785186ded75f3cde587463409a2148ddb81bfef8de8f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.0 2026-04-27
2
+
3
+ - Remove custom -Wxxx CFLAGS
4
+
1
5
  # 0.33.0 2026-04-12
2
6
 
3
7
  - Use buffer pool for `#read_each`, `#recv_each` methods
data/README.md CHANGED
@@ -37,7 +37,7 @@ implementation that allows integration with the entire Ruby ecosystem.
37
37
  - Excellent performance characteristics for concurrent I/O-bound applications.
38
38
  - `Fiber::Scheduler` implementation to automatically integrate with the Ruby
39
39
  ecosystem in a transparent fashion.
40
- - [IO](#io-api) class with automatic buffer management for reading.
40
+ - [UM::IO](#io-higher-level-api) class with automatic buffer management for reading.
41
41
  - Optimized I/O for encrypted SSL connections.
42
42
 
43
43
  ## Design
@@ -286,7 +286,7 @@ fiber = Fiber.schedule do
286
286
  end
287
287
  ```
288
288
 
289
- ## IO API
289
+ ## IO Higher-level API
290
290
 
291
291
  `UringMachine::IO` is a class designed for efficiently read from and write to a
292
292
  socket or other file descriptor. The IO class is ideal for implementing
data/TODO.md CHANGED
@@ -140,6 +140,4 @@ uint64_t alpha_numeric[] = [
140
140
  inline int test_char(char c, uint64 *bitmap) {
141
141
  return bitmap[c / 64] & (1UL << (c % 64));
142
142
  }
143
-
144
-
145
143
  ```
@@ -4,7 +4,7 @@ require_relative './common'
4
4
  require 'securerandom'
5
5
 
6
6
  C = ENV['C']&.to_i || 50
7
- I = 10
7
+ I = 100
8
8
  puts "C=#{C}"
9
9
 
10
10
  class UMBenchmark
@@ -12,6 +12,7 @@ class UMBenchmark
12
12
 
13
13
  def start_redis_server
14
14
  `docker run --name #{CONTAINER_NAME} -d -p 6379:6379 redis:latest`
15
+ create_redis_conn
15
16
  end
16
17
 
17
18
  def stop_redis_server
@@ -22,7 +23,7 @@ class UMBenchmark
22
23
  Redis.new
23
24
  rescue
24
25
  if retries < 3
25
- sleep 0.5
26
+ sleep 0.2
26
27
  create_redis_conn(retries + 1)
27
28
  else
28
29
  raise
@@ -31,7 +32,7 @@ class UMBenchmark
31
32
 
32
33
  def query_redis(conn)
33
34
  conn.set('abc', 'def')
34
- p conn.get('abc')
35
+ conn.get('abc')
35
36
  end
36
37
 
37
38
  def with_container
@@ -45,25 +46,33 @@ class UMBenchmark
45
46
  stop_redis_server
46
47
  end
47
48
 
49
+ def create_redis_conn(retries = 0)
50
+ Redis.new
51
+ rescue
52
+ raise if retries >= 3
53
+
54
+ sleep 0.5
55
+ create_redis_conn(retries + 1)
56
+ end
57
+
48
58
  def benchmark
49
59
  with_container {
50
60
  Benchmark.bm { run_benchmarks(it) }
51
61
  }
52
62
  end
53
63
 
54
- # def do_threads(threads, ios)
55
- # C.times.map do
56
- # threads << Thread.new do
57
- # conn = create_redis_conn
58
- # I.times { query_redis(conn) }
59
- # ensure
60
- # conn.close
61
- # end
62
- # end
63
- # end
64
+ def do_threads(threads, ios)
65
+ C.times.map do
66
+ threads << Thread.new do
67
+ conn = create_redis_conn
68
+ I.times { query_redis(conn) }
69
+ ensure
70
+ conn.close
71
+ end
72
+ end
73
+ end
64
74
 
65
75
  def do_scheduler(scheduler, ios)
66
- return if !scheduler.is_a?(UM::FiberScheduler)
67
76
  C.times do
68
77
  Fiber.schedule do
69
78
  conn = create_redis_conn
data/benchmark/common.rb CHANGED
@@ -62,7 +62,7 @@ class UMBenchmark
62
62
  # baseline_um: [:baseline_um, "UM no concurrency"],
63
63
  # thread_pool: [:thread_pool, "ThreadPool"],
64
64
 
65
- # threads: [:threads, "Threads"],
65
+ threads: [:threads, "Threads"],
66
66
 
67
67
  # async_uring: [:scheduler, "Async uring"],
68
68
  # async_uring_x2: [:scheduler_x, "Async uring x2"],
@@ -70,10 +70,10 @@ class UMBenchmark
70
70
  # async_epoll: [:scheduler, "Async epoll"],
71
71
  # async_epoll_x2: [:scheduler_x, "Async epoll x2"],
72
72
 
73
- # um_fs: [:scheduler, "UM FS"],
74
- # um_fs_x2: [:scheduler_x, "UM FS x2"],
73
+ um_fs: [:scheduler, "UM FS"],
74
+ um_fs_x2: [:scheduler_x, "UM FS x2"],
75
75
 
76
- # um: [:um, "UM"],
76
+ um: [:um, "UM"],
77
77
  # um_sidecar: [:um, "UM sidecar"],
78
78
  # um_sqpoll: [:um, "UM sqpoll"],
79
79
  um_x2: [:um_x, "UM x2"],
data/ext/um/extconf.rb CHANGED
@@ -74,11 +74,4 @@ $defs << '-DHAVE_IO_URING_PREP_BIND' if config[:prep_bind]
74
74
  $defs << '-DHAVE_IO_URING_PREP_LISTEN' if config[:prep_listen]
75
75
  $defs << '-DHAVE_IO_URING_SEND_VECTORIZED' if config[:send_vectoized]
76
76
 
77
- $CFLAGS << ' -Werror -Wall -Wextra'
78
-
79
- if ENV['SANITIZE']
80
- $CFLAGS << ' -fsanitize=undefined,address -lasan'
81
- $LDFLAGS << ' -fsanitize=undefined,address -lasan'
82
- end
83
-
84
77
  create_makefile 'um_ext'
data/ext/um/um.c CHANGED
@@ -62,8 +62,7 @@ inline struct io_uring_sqe *um_get_sqe(struct um *machine, struct um_op *op) {
62
62
  machine->metrics.ops_unsubmitted, machine->metrics.ops_pending, machine->metrics.total_ops
63
63
  );
64
64
 
65
- struct io_uring_sqe *sqe;
66
- sqe = io_uring_get_sqe(&machine->ring);
65
+ struct io_uring_sqe *sqe = io_uring_get_sqe(&machine->ring);
67
66
  if (likely(sqe)) goto done;
68
67
 
69
68
  um_raise_internal_error("Submission queue full. Consider raising the machine size.");
@@ -282,22 +281,22 @@ void *um_wait_for_cqe_without_gvl(void *ptr) {
282
281
  return NULL;
283
282
  }
284
283
 
285
- inline void um_profile_wait_cqe_pre(struct um *machine, double *time_monotonic0, VALUE *fiber) {
286
- // *fiber = rb_fiber_current();
287
- *time_monotonic0 = um_get_time_monotonic();
288
- // double time_cpu = um_get_time_cpu();
289
- // double elapsed = time_cpu - machine->metrics.time_last_cpu;
290
- // um_update_fiber_time_run(fiber, time_monotonic0, elapsed);
291
- // machine->metrics.time_last_cpu = time_cpu;
292
- }
284
+ // inline void um_profile_wait_cqe_pre(struct um *machine, double *time_monotonic0, VALUE *fiber) {
285
+ // VALUE fiber = rb_fiber_current();
286
+ // *time_monotonic0 = um_get_time_monotonic();
287
+ // double time_cpu = um_get_time_cpu();
288
+ // double elapsed = time_cpu - machine->metrics.time_last_cpu;
289
+ // um_update_fiber_time_run(fiber, time_monotonic0, elapsed);
290
+ // machine->metrics.time_last_cpu = time_cpu;
291
+ // }
293
292
 
294
- inline void um_profile_wait_cqe_post(struct um *machine, double time_monotonic0, VALUE fiber) {
295
- // double time_cpu = um_get_time_cpu();
296
- double elapsed = um_get_time_monotonic() - time_monotonic0;
297
- // um_update_fiber_last_time(fiber, cpu_time1);
298
- machine->metrics.time_total_wait += elapsed;
299
- // machine->metrics.time_last_cpu = time_cpu;
300
- }
293
+ // inline void um_profile_wait_cqe_post(struct um *machine, double time_monotonic0, VALUE fiber) {
294
+ // // double time_cpu = um_get_time_cpu();
295
+ // double elapsed = um_get_time_monotonic() - time_monotonic0;
296
+ // // um_update_fiber_last_time(fiber, cpu_time1);
297
+ // machine->metrics.time_total_wait += elapsed;
298
+ // // machine->metrics.time_last_cpu = time_cpu;
299
+ // }
301
300
 
302
301
  inline void *um_wait_for_sidecar_signal(void *ptr) {
303
302
  struct um *machine = ptr;
@@ -329,11 +328,11 @@ static inline void um_wait_for_and_process_ready_cqes(struct um *machine, int wa
329
328
  // fprintf(stderr, "<< sidecar wait cqes\n");
330
329
  }
331
330
  else {
332
- double time_monotonic0 = 0.0;
333
- VALUE fiber;
334
- if (machine->profile_mode) um_profile_wait_cqe_pre(machine, &time_monotonic0, &fiber);
331
+ // double time_monotonic0 = 0.0;
332
+ // VALUE fiber;
333
+ // if (machine->profile_mode) um_profile_wait_cqe_pre(machine, &time_monotonic0, &fiber);
335
334
  rb_thread_call_without_gvl(um_wait_for_cqe_without_gvl, (void *)&ctx, RUBY_UBF_IO, 0);
336
- if (machine->profile_mode) um_profile_wait_cqe_post(machine, time_monotonic0, fiber);
335
+ // if (machine->profile_mode) um_profile_wait_cqe_post(machine, time_monotonic0, fiber);
337
336
 
338
337
  if (unlikely(ctx.result < 0)) {
339
338
  // the internal calls to (maybe submit) and wait for cqes may fail with:
@@ -357,14 +356,14 @@ static inline void um_wait_for_and_process_ready_cqes(struct um *machine, int wa
357
356
  }
358
357
  }
359
358
 
360
- inline void um_profile_switch(struct um *machine, VALUE next_fiber) {
361
- // *current_fiber = rb_fiber_current();
362
- // double time_cpu = um_get_time_cpu();
363
- // double elapsed = time_cpu - machine->metrics.time_last_cpu;
364
- // um_update_fiber_time_run(cur_fiber, time_cpu, elapsed);
365
- // um_update_fiber_time_wait(next_fiber, time_cpu);
366
- // machine->metrics.time_last_cpu = time_cpu;
367
- }
359
+ // inline void um_profile_switch(struct um *machine, VALUE next_fiber) {
360
+ // VALUE current_fiber = rb_fiber_current();
361
+ // double time_cpu = um_get_time_cpu();
362
+ // double elapsed = time_cpu - machine->metrics.time_last_cpu;
363
+ // um_update_fiber_time_run(cur_fiber, time_cpu, elapsed);
364
+ // um_update_fiber_time_wait(next_fiber, time_cpu);
365
+ // machine->metrics.time_last_cpu = time_cpu;
366
+ // }
368
367
 
369
368
  inline VALUE process_runqueue_op(struct um *machine, struct um_op *op) {
370
369
  DEBUG_PRINTF("* process_runqueue_op: op=%p kind=%s ref_count=%d flags=%x\n",
@@ -378,7 +377,7 @@ inline VALUE process_runqueue_op(struct um *machine, struct um_op *op) {
378
377
  op->flags &= ~OP_F_SCHEDULED;
379
378
  um_op_release(machine, op);
380
379
 
381
- if (machine->profile_mode) um_profile_switch(machine, fiber);
380
+ // if (machine->profile_mode) um_profile_switch(machine, fiber);
382
381
  VALUE ret = rb_fiber_transfer(fiber, 1, &value);
383
382
  RB_GC_GUARD(value);
384
383
  RB_GC_GUARD(ret);
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UringMachine
4
- VERSION = '0.33.0'
4
+ VERSION = '1.0.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uringmachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner