# ********** PrototypeDemo.pl ********** 
use strict;
use HashTable;
use ConcretePrototype1;
use Time::HR;

my $t1 = gethrtime();
my $i;
my $j;
my $protoManager = HashTable->new();
for ($i=0; $i<1000; $i++) {
  $protoManager->insert($i,ConcretePrototype1->new($i));
}
for ($i=0; $i<1000; $i++) {
  my $p = $protoManager->find($i);
  $p->set($p->get()+1);
  for ($j=0; $j<1000; $j++) {
    my $proto = $p->clone();
  }
}
my $t2 = gethrtime();
print (int(($t2-$t1)/1000000))." ";
