# ********** FactoryDemo.pl **********
use strict;
use Factory;
use Time::HR;

my $t1 = gethrtime();
my $i;
my $j;
for ($i=0; $i<10*1000; $i++) {
  my $product1 = Factory->createProduct(1);
  my $product2 = Factory->createProduct(2);
  for ($j=0; $j<1000; $j++) {
    $product1->operation();
    $product2->operation();
  }
}
my $t2 = gethrtime();
print (int(($t2-$t1)/1000000))." ";
