Forum: Ruby ruby-prof for WATIR testcase calls WIN32OLE#method_missing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sandeep G. (Guest)
on 2009-06-09 17:22
Attachment: profile.zip (0 Bytes)
Hi all,

I generated ruby profile for my test suite. In my profile i observed
that 10% of my test time is taken by WIN32OLE#method_missing. It was
called 60077 times.

Can anyone please help me understand when and why it is getting called.
Is there any way to optimize it ?

I'm using
ruby 1.8.4
watir 1.5.1.1192
ruby-prof 0.7.3

I'm attaching my generated ruby graph profile.

Thanks,
Sandeep
Heesob P. (Guest)
on 2009-06-09 18:22
(Received via mailing list)
Hi,

2009/6/9 Sandeep G. <removed_email_address@domain.invalid>:
> Hi all,
>
> I generated ruby profile for my test suite. In my profile i observed
> that 10% of my test time is taken by WIN32OLE#method_missing. It was
> called 60077 times.
>
> Can anyone please help me understand when and why it is getting called.
> Is there any way to optimize it ?
>
That is the way WIN32OLE work. All properties and methods pass through
method_missing.

The C code can be written with Ruby code like this:

  def method_missing(id,*args)
    method = id.to_s
    if method[-1] == ?=
      method = method[0..-2]
      return ole_propertyput(method,args.first)
    else
      return ole_invoke(method, args,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, false)
    end
  end



Regards,
Park H.
This topic is locked and can not be replied to.