[Wtr-general] Extreme slowdown moving from 1.4.1 to 1.5.1.1127
Bret Pettichord
bret at pettichord.com
Tue Dec 19 20:42:22 EST 2006
Pat Mac wrote:
> Thanks for the reply Bret. The first thing I noticed from your email
> is that I missed the new IE set_fast_speed method so perhaps that will
> bring the execution time back in line.
That makes a big difference. That feature is also found in 1.4. There is
a command line switch that can be used to turn it on.
> I agree that it's nearly impossible to debug these kinds of issues
> without a public test suite. I am getting killed at work right now
> but I will look into adding some timing tests and running some 1.4 to
> 1.5 comparisions with the Instiki test suite hopefully around the
> first of the year.
I was thinking about the details of your analysis while looking through
the code and I realized that there was a simple change that could be
made to improve performance. This code is attached below as a patch.
I found that this change provided a 4% improvement when running the core
watir unit tests, but a 16% improvement in one of the tests i've been
working with recently for my company's application. It will provide the
biggest improvement when (1) the application has a DOM with lots of
elements and (2) you make repeated use of elements stored in variables.
name = ie.text_field(:id, 'name')
name.set(name) if name.exists?
What the change does is cache the reference for the second call.
Although all the unit tests passed with this change, there are likely to
be uses out there this would break, so i am reluctant to add this code
to Watir without putting some kind of guard on it.
Bret
Index: C:/_workspace/watir/watir.rb
===================================================================
--- C:/_workspace/watir/watir.rb (revision 1132)
+++ C:/_workspace/watir/watir.rb (working copy)
@@ -2306,6 +2306,7 @@
public
def assert_exists
+ return ole_object if ole_object
locate if defined?(locate)
unless ole_object
raise UnknownObjectException.new("Unable to locate object,
using #{@how} and #{@what}")
More information about the Wtr-general
mailing list