summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2020-11-24 16:30:52 +0900
committerKOBAYASHI Shuji <[email protected]>2020-11-24 16:30:52 +0900
commitdb00fb238be221f58414d5b5763321706e262f24 (patch)
tree2860aa510340d14a35f80fab9e5ce3dd294ec78f /Rakefile
parent36e3c4404af102411b6949e672aa6b73768945d5 (diff)
downloadmruby-db00fb238be221f58414d5b5763321706e262f24.tar.gz
mruby-db00fb238be221f58414d5b5763321706e262f24.zip
Optimize `presym_find`
Chang to compare string length first. ### Benchmark #### Code * https://github.com/shuujii/mruby-presym_find-benchmark #### Result ```console Previous: 10.240772M i/s (25M times in 2.441222s) New: 16.412985M i/s (25M times in 1.523184s) ```
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 1a8663400..1fc0de999 100644
--- a/Rakefile
+++ b/Rakefile
@@ -192,7 +192,7 @@ file presym_file => cfiles+rbfiles+psfiles+[__FILE__] do
src.scan(/[ \(\[\{]:'([^']+)'/)
]
end
- symbols = (symbols+csymbols+rbsymbols+op_table.keys).flatten.compact.uniq.sort.grep_v(/#/).map{|x| x.gsub("\n", '\n')}
+ symbols = (symbols+csymbols+rbsymbols+op_table.keys).flatten.compact.uniq.grep_v(/#/).map{|x| x.gsub("\n", '\n')}.sort_by!{|x| [x.bytesize, x]}
presyms = File.readlines(presym_file) rescue []
presyms.each{|x| x.chomp!}
if presyms != symbols