Defect #43737
closedRendering wiki is significantly slow on Ruby 4.0.1
Description
On Ruby 4.0.1, rendering wiki via Redmine::WikiFormatting.to_html is significantly slower than on Ruby 3.4.
The benchmarks below suggest:
- wiki rendering is consistently slower on Ruby 4.0.1
- the impact is larger for CommonMark
- the slowdown is more pronounced when the input includes a table and a code block
- performance regresses further after the #43643 related commits
CommonMark¶
After #43643¶
Ruby 4.0.1:
Ruby 3.4.7:
Before #43643¶
Ruby 4.0.1
Ruby 3.4.7
Textile¶
After #43643¶
Ruby 4.0.1:
Ruby 3.4.7:
Before #43643¶
Ruby 4.0.1
Ruby 3.4.7
Environment¶
- Ruby 4.0.1 vs Ruby 3.4.7 (same Gemfile.lock)
- commonmarker 2.6.3
- loofah 2.25.0
- rouge 4.7.0
Files
Updated by Marius BĂLTEANU 10 months ago
We should wait for the fix mentioned by Pavel in #43650#note-1021824 to be released or to test against the ruby dev from the master branch. I tried to do a quick test, but the build fails on my environment.
Updated by Pavel Rosický 10 months ago
Thanks for the reproducer. I tested the master branch, and it’s still slow, so https://bugs.ruby-lang.org/issues/21824 is not the cause.
We would need to bisect the changes between 3.4.8 -> 4.0.0. I’ve filed a report at https://bugs.ruby-lang.org/issues/21856
Updated by Holger Just 10 months ago
- Related to Feature #43650: Ruby 4.0 support added
Updated by Marius BĂLTEANU 9 months ago
The fix was merged to master and it will be backport to 4.0 branch: https://bugs.ruby-lang.org/issues/21856#note-10
Updated by Marius BĂLTEANU 7 months ago
Using Ruby 4.0.3 which was released I obtain the following results:
ruby=4.0.3 iter=20 mult=5
commonmarker=2.6.3 loofah=2.25.1 rouge=4.7.0
full_ms=142.18 avg_full=7.11
user:hidakatsuya, can you re-run your tests as well?
Updated by Katsuya HIDAKA 7 months ago
Sorry for the late reply.
I got same benchmark results with 4.0.3:
With Ruby 4.0.5, the benchmark results are as follows:
https://bugs.ruby-lang.org/issues/21856 seems to have been fixed in Ruby 4.0.4: https://github.com/ruby/ruby/pull/16434
I'm not sure why the performance was already improved in Ruby 4.0.3, but I think we can close this issue.
Updated by Marius BĂLTEANU 7 months ago
- Status changed from New to Closed
- Resolution set to Fixed
I think there were multiple issues on the same topic.