Project

General

Profile

« Previous | Next » 

Revision c93d07ed

Added by yui-knk (Kaneko Yuichiro) about 1 year ago

[Bug #20695] Do not create needless string object in parser

set_parser_s_value does nothing in parser therefore no need to
create string object in parser set_yylval_node.

Object allocation

Run ruby benchmarks/lobsters/benchmark.rb with the patch

diff --git a/benchmarks/lobsters/benchmark.rb b/benchmarks/lobsters/benchmark.rb index 240c50c..6cdd0ac 100644 --- a/benchmarks/lobsters/benchmark.rb +++ b/benchmarks/lobsters/benchmark.rb @@ -7,6 +7,8 @@ Dir.chdir __dir__ use_gemfile   require_relative 'config/environment' +printf "allocated_after_load=%d\n", GC.stat(:total_allocated_objects) +exit  require_relative "route_generator"   # For an in-mem DB, we need to load all data on every boot 

Before

ruby 3.4.0dev (2024-08-31T18:30:25Z master d6fc8f3d57) [arm64-darwin21] ... allocated_after_load=2143519 

After

ruby 3.4.0dev (2024-09-01T00:40:04Z fix_bugs_20695 d1bae52f75) [arm64-darwin21] ... allocated_after_load=1579662 

Ruby 3.3.0 for reference

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin21] ... allocated_after_load=1732702