Comment 0 for bug 1901074

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : [SRU] Enable some arm64 optimizations

[Impact]

Upstream merged some changes to improve performance on arm64 which could benefit Ubuntu users:

https://github.com/ruby/ruby/commit/511b55bcefc81c03

Those changes considerably increase the number of instructions executed per second (ips) and also reduce the time to execute different tasks. On the other hand, it increases a bit the memory consumption. Here you can find the results of an experiment where some benchmarks defined by upstream were executed with the proposed patch on top of the Focal source package, a simple rebuild of the Focal version, and the binary from the archive in a Raspberry Pi 4 and a Canonistack VM (check the summary tab):

https://docs.google.com/spreadsheets/d/1_-H78uBDrlKHcmH1IPCbnxhLsNnD6Nj-Ya31_QSnW54/edit?usp=sharing

It is quite impressive how under some circumstances the ips was increased in more than 50% and the time taken to execute some tasks reduced more than 25%. IMHO those numbers are really good, and the small increase of at most 4% in the memory consumption worth in this case.

[Test Case]

Run the upstream benchmarks in a Ubuntu Focal arm64 machine:

1 - Install the ruby2.7 binary form the archive.
2 - Rebuild the ruby2.7 source package from Focal and install it.
3 - Build the ruby2.7 source package from Focal with the optimization patch on top of it and install it.
4 - Install the benchmark_driver gem. It is not in the archive, so install it from rubygems (sudo gem install benchmark_driver).
5 - Download the benchmarks definition from upstream master branch (https://github.com/ruby/ruby/raw/master/benchmark/). They are:
  * vm_array.yml
  * vm_attr_ivar_set.yml
  * vm_bigarray.yml
  * vm_block.yml
  * vm_attr_ivar.yml
  * vm_backtrace.rb
  * vm_bighash.yml
  * vm_block_handler.yml
6 - Run the benchmarks (in the presented experiment 6 rounds were executed):

$ benchmark-driver $BENCHMARK_INPUT_DIR/*.yml \
 -r $runner -e $RUBY_SYSTEM -e $RUBY_PATCHED -e $RUBY_REBUILT

where $BENCHMARK_INPUT_DIR is the directory with the benchmarks definition and $RUBY* is the path to the respective ruby versions under analysis.

[Regression Potential]

The code changes impact only aarch64 so no regression is expected in other architectures. No breakage during runtime is expected.

Based on the experiment presented above we might expect some extra memory consumption hitting users. However, the increase of at most 4% of memory consumption faced during the experiment seems a fair price to pay for the boost in performance this patch will provide.