[tools] testbot: Slightly speed up the Item property accesses.

Francois Gouget fgouget at codeweavers.com
Wed Apr 13 12:08:17 CDT 2022


substr()+rindex() is a bit faster than the regular expression for
separating the class name from the property name.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
The gain is about 15%.

There are much bigger gains to be had here but the way 
Collections and Items sometimes put properties in the MasterColNames and 
MasterColValues arrays gets in the way. I've come to the conclusion that 
MasterCol*s makes no sense and should go away. The question is whether 
that theory will be confirmed in practice.
---
 testbot/lib/ObjectModel/Item.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testbot/lib/ObjectModel/Item.pm b/testbot/lib/ObjectModel/Item.pm
index 9cec7b47b..c086aec40 100644
--- a/testbot/lib/ObjectModel/Item.pm
+++ b/testbot/lib/ObjectModel/Item.pm
@@ -228,9 +228,8 @@ sub AUTOLOAD
 {
   my $self = shift;
 
-  my $PropertyName = $ObjectModel::Item::AUTOLOAD;
   # strip fully-qualified portion
-  $PropertyName =~ s/.*://;
+  my $PropertyName = substr($ObjectModel::Item::AUTOLOAD, rindex($ObjectModel::Item::AUTOLOAD, ':') + 1);
   if ($PropertyName eq "DESTROY")
   {
     return;
-- 
2.30.2




More information about the wine-devel mailing list