* [ruby-core:65518] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
@ 2014-10-08 12:16 ` Knut.Franke
2014-10-08 23:33 ` [ruby-core:65535] " Eric Wong
2014-10-08 23:41 ` [ruby-core:65536] [ruby-trunk - Feature #10341] " normalperson
` (10 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: Knut.Franke @ 2014-10-08 12:16 UTC (permalink / raw
To: ruby-core
Issue #10341 has been reported by Knut Franke.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65535] Re: [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements
2014-10-08 12:16 ` [ruby-core:65518] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements Knut.Franke
@ 2014-10-08 23:33 ` Eric Wong
0 siblings, 0 replies; 15+ messages in thread
From: Eric Wong @ 2014-10-08 23:33 UTC (permalink / raw
To: Ruby developers
Cool, I can confirm the performance results on one of my systems.
I do not know the fiber code well, but it seems correct.
I think fiber_mark_self (and any non-static functions) needs to be
prefixed with "rb_" even if it is an internal API.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65536] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
2014-10-08 12:16 ` [ruby-core:65518] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements Knut.Franke
@ 2014-10-08 23:41 ` normalperson
2014-10-11 20:58 ` [ruby-core:65621] " Knut.Franke
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: normalperson @ 2014-10-08 23:41 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Eric Wong.
Cool, I can confirm the performance results on one of my systems.
I do not know the fiber code well, but it seems correct.
I think fiber_mark_self (and any non-static functions) needs to be
prefixed with "rb_" even if it is an internal API.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49307
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65621] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
2014-10-08 12:16 ` [ruby-core:65518] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements Knut.Franke
2014-10-08 23:41 ` [ruby-core:65536] [ruby-trunk - Feature #10341] " normalperson
@ 2014-10-11 20:58 ` Knut.Franke
2014-10-12 0:28 ` [ruby-core:65623] " Eric Wong
2014-10-12 0:29 ` [ruby-core:65624] " normalperson
` (8 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: Knut.Franke @ 2014-10-11 20:58 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Knut Franke.
File 0005-Optimize-fiber_switch-callees.patch added
Attached a revised version of patch 5 with fiber_mark_self replaced by rb_fiber_mark_self. Thanks for the hint.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49358
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65623] Re: [ruby-trunk - Feature #10341] Fiber switch performance improvements
2014-10-11 20:58 ` [ruby-core:65621] " Knut.Franke
@ 2014-10-12 0:28 ` Eric Wong
0 siblings, 0 replies; 15+ messages in thread
From: Eric Wong @ 2014-10-12 0:28 UTC (permalink / raw
To: Ruby developers
Thanks. I'll wait a few days for others to look and try it out
before committing.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65624] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (2 preceding siblings ...)
2014-10-11 20:58 ` [ruby-core:65621] " Knut.Franke
@ 2014-10-12 0:29 ` normalperson
2014-10-16 0:15 ` [ruby-core:65736] [ruby-trunk - Feature #10341] [Open] " nobu
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: normalperson @ 2014-10-12 0:29 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Eric Wong.
Thanks. I'll wait a few days for others to look and try it out
before committing.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49359
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65736] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (3 preceding siblings ...)
2014-10-12 0:29 ` [ruby-core:65624] " normalperson
@ 2014-10-16 0:15 ` nobu
2014-10-16 0:17 ` [ruby-core:65737] [ruby-trunk - Feature #10341] [Closed] " nobu
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: nobu @ 2014-10-16 0:15 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Nobuyoshi Nakada.
Status changed from Closed to Open
I've missed this ticket, and r47964 caused compile error.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49474
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65737] [ruby-trunk - Feature #10341] [Closed] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (4 preceding siblings ...)
2014-10-16 0:15 ` [ruby-core:65736] [ruby-trunk - Feature #10341] [Open] " nobu
@ 2014-10-16 0:17 ` nobu
2014-10-16 4:29 ` [ruby-core:65745] [ruby-trunk - Feature #10341] [Open] " ko1
` (5 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: nobu @ 2014-10-16 0:17 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Nobuyoshi Nakada.
Status changed from Open to Closed
Applied in changeset r47969.
----------
cont.c: fix compile error
* cont.c (rb_fiber_t): fix compile error caused by move to
vm_core.h at r47964. [Feature #10341]
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49475
* Author: Knut Franke
* Status: Closed
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65745] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (5 preceding siblings ...)
2014-10-16 0:17 ` [ruby-core:65737] [ruby-trunk - Feature #10341] [Closed] " nobu
@ 2014-10-16 4:29 ` ko1
2014-10-16 4:30 ` [ruby-core:65746] [ruby-trunk - Feature #10341] " ko1
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: ko1 @ 2014-10-16 4:29 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Koichi Sasada.
Status changed from Closed to Open
on mswin32, the following simple script doesn't work.
```ruby
p Fiber.new{
100
}.resume
```
```
#=>
C:/ko1/src/ruby/trunk/test.rb:1:in `p': method `inspect' called on
hidden T_OBJECT object (0x1ea6730 flags=0x1) (NotImplementedError)
from C:/ko1/src/ruby/trunk/test.rb:1:in `<main>'
NMAKE : fatal error U1077: '.\miniruby.exe' : リターン コード '0x1'
Stop.
```
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49481
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65746] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (6 preceding siblings ...)
2014-10-16 4:29 ` [ruby-core:65745] [ruby-trunk - Feature #10341] [Open] " ko1
@ 2014-10-16 4:30 ` ko1
2014-10-16 5:01 ` [ruby-core:65749] " Eric Wong
2014-10-16 5:10 ` [ruby-core:65751] " normalperson
` (3 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: ko1 @ 2014-10-16 4:30 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Koichi Sasada.
disable FIBER_USE_NATIVE works fine on mswin32.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49482
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65749] Re: [ruby-trunk - Feature #10341] Fiber switch performance improvements
2014-10-16 4:30 ` [ruby-core:65746] [ruby-trunk - Feature #10341] " ko1
@ 2014-10-16 5:01 ` Eric Wong
0 siblings, 0 replies; 15+ messages in thread
From: Eric Wong @ 2014-10-16 5:01 UTC (permalink / raw
To: Ruby developers; +Cc: Knut Franke
Maybe this is a simple fix for win32, but I cannot test:
diff --git a/cont.c b/cont.c
index 739ec80..08acf40 100644
--- a/cont.c
+++ b/cont.c
@@ -1366,10 +1366,10 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
terminated_machine_stack.ptr = NULL;
terminated_machine_stack.size = 0;
}
+#endif /* not _WIN32 */
fib = th->fiber;
if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
return fib->cont.value;
-#endif /* not _WIN32 */
#else /* FIBER_USE_NATIVE */
cont_save_machine_stack(th, &fib->cont);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [ruby-core:65751] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (7 preceding siblings ...)
2014-10-16 4:30 ` [ruby-core:65746] [ruby-trunk - Feature #10341] " ko1
@ 2014-10-16 5:10 ` normalperson
2014-10-16 5:58 ` [ruby-core:65754] " ko1
` (2 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: normalperson @ 2014-10-16 5:10 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Eric Wong.
Maybe this is a simple fix for win32, but I cannot test:
diff --git a/cont.c b/cont.c
index 739ec80..08acf40 100644
--- a/cont.c
+++ b/cont.c
@@ -1366,10 +1366,10 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
terminated_machine_stack.ptr = NULL;
terminated_machine_stack.size = 0;
}
+#endif /* not _WIN32 */
fib = th->fiber;
if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
return fib->cont.value;
-#endif /* not _WIN32 */
#else /* FIBER_USE_NATIVE */
cont_save_machine_stack(th, &fib->cont);
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49484
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65754] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (8 preceding siblings ...)
2014-10-16 5:10 ` [ruby-core:65751] " normalperson
@ 2014-10-16 5:58 ` ko1
2014-10-16 7:20 ` [ruby-core:65758] " ko1
2014-10-18 11:20 ` [ruby-core:65779] " Knut.Franke
11 siblings, 0 replies; 15+ messages in thread
From: ko1 @ 2014-10-16 5:58 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Koichi Sasada.
Eric Wong wrote:
> Maybe this is a simple fix for win32, but I cannot test:
Thank you. Now, it is working. I'm running test-all now.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49487
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65758] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (9 preceding siblings ...)
2014-10-16 5:58 ` [ruby-core:65754] " ko1
@ 2014-10-16 7:20 ` ko1
2014-10-18 11:20 ` [ruby-core:65779] " Knut.Franke
11 siblings, 0 replies; 15+ messages in thread
From: ko1 @ 2014-10-16 7:20 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Koichi Sasada.
It works fine!
Thank you.
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49491
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:65779] [ruby-trunk - Feature #10341] Fiber switch performance improvements
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
` (10 preceding siblings ...)
2014-10-16 7:20 ` [ruby-core:65758] " ko1
@ 2014-10-18 11:20 ` Knut.Franke
11 siblings, 0 replies; 15+ messages in thread
From: Knut.Franke @ 2014-10-18 11:20 UTC (permalink / raw
To: ruby-core
Issue #10341 has been updated by Knut Franke.
D'oh. Thanks for fixing the win32/non-native issues.
And great to see this included. :-)
----------------------------------------
Feature #10341: Fiber switch performance improvements
https://bugs.ruby-lang.org/issues/10341#change-49515
* Author: Knut Franke
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The attached patches increase performance of switches between Fibers by ~17% on my test system (Linux, gcc 4.8.2).
Patches 1-3 are purely cosmetic, but included here because submitting them separately would cause conflicts between the patch sets. If these are rejected, I can prepare stand-alone versions of 4/5.
Patch 4 yields the most significant performance increase (~12%). The benefit of patch 5 is lower, and it's a larger change; so this one could optionally be omitted.
~~~
require 'benchmark'
fib = Fiber.new do
loop { Fiber.yield }
end
Benchmark.bm do |bm|
3.times do
results << bm.report { 10_000_000.times { fib.resume } }
end
avg = results.inject(:+) / results.size
[avg]
end
~~~
Raw benchmarking results:
~~~
trunk@47827 - 7.59s
patch 4 - 6.59s (87% of trunk)
patch 4+5 - 6.33s (83% of trunk)
~~~
---Files--------------------------------
0001-Remove-unused-prev_fiber-next_fiber-fields.patch (2.02 KB)
0002-Code-cleanup-in-fiber_switch-fiber_store.patch (4.79 KB)
0003-Small-code-cleanup.patch (1.16 KB)
0004-cont_save_thread-Sparse-copying-of-thread-data.patch (3.39 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
0005-Optimize-fiber_switch-callees.patch (13.9 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-10-18 11:36 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-10341.20141008121647@ruby-lang.org>
2014-10-08 12:16 ` [ruby-core:65518] [ruby-trunk - Feature #10341] [Open] Fiber switch performance improvements Knut.Franke
2014-10-08 23:33 ` [ruby-core:65535] " Eric Wong
2014-10-08 23:41 ` [ruby-core:65536] [ruby-trunk - Feature #10341] " normalperson
2014-10-11 20:58 ` [ruby-core:65621] " Knut.Franke
2014-10-12 0:28 ` [ruby-core:65623] " Eric Wong
2014-10-12 0:29 ` [ruby-core:65624] " normalperson
2014-10-16 0:15 ` [ruby-core:65736] [ruby-trunk - Feature #10341] [Open] " nobu
2014-10-16 0:17 ` [ruby-core:65737] [ruby-trunk - Feature #10341] [Closed] " nobu
2014-10-16 4:29 ` [ruby-core:65745] [ruby-trunk - Feature #10341] [Open] " ko1
2014-10-16 4:30 ` [ruby-core:65746] [ruby-trunk - Feature #10341] " ko1
2014-10-16 5:01 ` [ruby-core:65749] " Eric Wong
2014-10-16 5:10 ` [ruby-core:65751] " normalperson
2014-10-16 5:58 ` [ruby-core:65754] " ko1
2014-10-16 7:20 ` [ruby-core:65758] " ko1
2014-10-18 11:20 ` [ruby-core:65779] " Knut.Franke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).