<charliesome>
i was investigating ruby performance on a rails app i work on
<_ko1>
cool
<charliesome>
and i noticed that whenever we use OpenStruct, all the method caches are invalidated because it defines methods on its singleton class
<judofyr>
charliesome: yes, I've also noticed *really* bad performance using OpenStruct
<charliesome>
i thought about it for a bit and i think i have an idea to avoid invalidating the cache when defining singleton methods
<charliesome>
we should store an inherited flag on RClass structs that is set to true when it is inherited
<charliesome>
when defining a method, the vm state is only incremented if a) the method definition overrides an existing one or b) the class has subclasses (inherited flag is set)
<charliesome>
_ko1: thoughts?
<charliesome>
judofyr: yeah i was surprised as well
<_ko1>
n-
<_ko1>
not enough
<charliesome>
is there a scenario where this causes incorrect behaviour, or do you not think this case is worthy of optimization?
<charliesome>
because defining singleton methods on individual object is a *very* common operation
<_ko1>
no doubt that it is worth
<_ko1>
wait a morment
xibbar has quit [Remote host closed the connection]
<_ko1>
it my mistake
<_ko1>
your idea is good
<_ko1>
the last problem is
<_ko1>
set a flag correctly
<_ko1>
set a `inherited' flag
xibbar has joined #ruby-core
<_ko1>
big 2.1 feature :)
<_ko1>
charliesome: do you have a patch?
<charliesome>
_ko1: i have been experimenting, nothing working yet
<charliesome>
_ko1: would you like me to work on a patch?
<charliesome>
then i can submit it for your review
<_ko1>
if you can :)
<charliesome>
awesome
_br_ has quit [Excess Flood]
<_ko1>
rails people like OpenStruct?
<charliesome>
_ko1: not sure about rails itself, but openstruct is very commonly used
<_ko1>
wow
<_ko1>
why people don't use Hash
<_ko1>
...
<charliesome>
_ko1: they like the method call syntax
<charliesome>
i hacked my copy of ruby at work to print a star to the terminal every time the vm state was incremented
<charliesome>
200 vm state changes per request :\
<_ko1>
LoL
<charliesome>
many were from openstruct
<_ko1>
good consideration
<_ko1>
there are several ideas about inline cache invalidation protocol
<_ko1>
(1) use only vm state (current)
<_ko1>
(2) separate vm state (JRuby use)
<charliesome>
_ko1: i noticed you have future support for only invalidating by a certain ID
<_ko1>
(2) separate vm state by Classes/Modules (JRuby use)
<charliesome>
as in, the function is there but at the moment it just invalidates everything
<_ko1>
(3) separate vm state by method names (Rubinius use)
<_ko1>
(4) more complex one
<charliesome>
unfortunately different invalidation strategies might be better or worse for different apps
<znz_v>
biff: [ruby-changes:27085] akr:r39136 (trunk): * process.c (obj2gid): use getgrnum_r() only if getgrnam_r() and - http://mla.n-z.jp/?ruby-changes=27085
judofyr has quit [Remote host closed the connection]
johndouthat has joined #ruby-core
oscardelben has quit [Quit: oscardelben]
idkazuma has quit [Remote host closed the connection]
carlosan_ has joined #ruby-core
carlosantonio has quit [Ping timeout: 248 seconds]
_br_ has quit [Excess Flood]
_br_ has joined #ruby-core
judofyr has joined #ruby-core
_br_ has quit [Excess Flood]
_br_ has joined #ruby-core
marcandre has joined #ruby-core
__BigO__ has quit [Remote host closed the connection]
__BigO__ has joined #ruby-core
carlosantonio has joined #ruby-core
carlosan_ has quit [Ping timeout: 256 seconds]
wakoinc has joined #ruby-core
wakoinc has quit [Changing host]
wakoinc has joined #ruby-core
drbrain has quit [Remote host closed the connection]
_br_ has quit [Excess Flood]
wakoinc has quit [Read error: Connection reset by peer]
wakoinc has joined #ruby-core
judofyr has quit [Remote host closed the connection]
_br_ has joined #ruby-core
_br_ has quit [Excess Flood]
_br_ has joined #ruby-core
tenderlove has quit [Remote host closed the connection]
johndouthat has quit [Quit: johndouthat]
johndouthat has joined #ruby-core
johndouthat has quit [Remote host closed the connection]
drbrain has joined #ruby-core
tenderlove has joined #ruby-core
kosaki8 has joined #ruby-core
__BigO__ has quit [Remote host closed the connection]
wakoinc has quit [Quit: wakoinc]
tenderlove has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby-core
hone has quit [Ping timeout: 276 seconds]
hone has joined #ruby-core
hone has quit [Ping timeout: 255 seconds]
hone has joined #ruby-core
idkazuma has joined #ruby-core
hone has quit [Ping timeout: 245 seconds]
hone has joined #ruby-core
__BigO__ has joined #ruby-core
xibbar has joined #ruby-core
drbrain has quit [Remote host closed the connection]
<znz_v>
biff: [ruby-changes:27087] drbrain:r39139 (trunk): * lib/rubygems/dependency_installer.rb: Only install local gems if - http://mla.n-z.jp/?ruby-changes=27087