---------- Forwarded message ----------
From: Charles O Nutter < [EMAIL PROTECTED]>
Date: Jun 4, 2006 4:17 PM
Subject: More performance numbers and a committable patch
To: jruby-devel@lists.sourceforge.net
ObjectSpace is slow.
I'm optimizing RubyString and seeing again and again how slow OS makes object creation. I've attached a patch that doesn't break anything and optimizes a few aspects of RubyString. Without OS enabled, this patch gives 15-20% improvement in the given microbenchmark. It's not quite as substantial as the gains from disabling OS, but it's faster and faster.
Changes:
- Don't call getClass("String") for every string instantiation; added IRuby.getString() to save the class on creation. This could be done for all builtins. Resulted in 5-10% faster excluding OS.
- Don't create StringBuffer right away; use CharSequence everywhere, create StringBuffer only when needed and use SB from then on. Resulted in another 5-10% faster excluding OS.
1_000_000.times { <14 literal strings> }
No optimization, OS enabled: 75s
String optimization, OS enabled: 72s
No optimization, OS disabled: 17s
String optimization, OS disabled: 14s
I'm optimizing RubyString and seeing again and again how slow OS makes object creation. I've attached a patch that doesn't break anything and optimizes a few aspects of RubyString. Without OS enabled, this patch gives 15-20% improvement in the given microbenchmark. It's not quite as substantial as the gains from disabling OS, but it's faster and faster.
Changes:
- Don't call getClass("String") for every string instantiation; added IRuby.getString() to save the class on creation. This could be done for all builtins. Resulted in 5-10% faster excluding OS.
- Don't create StringBuffer right away; use CharSequence everywhere, create StringBuffer only when needed and use SB from then on. Resulted in another 5-10% faster excluding OS.
1_000_000.times { <14 literal strings> }
No optimization, OS enabled: 75s
String optimization, OS enabled: 72s
No optimization, OS disabled: 17s
String optimization, OS disabled: 14s
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com
--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com
string_optimize_1.patch
Description: Binary data
_______________________________________________ Jruby-devel mailing list Jruby-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jruby-devel