Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use Modern::Perl; |
4 |
use Time::HiRes qw(gettimeofday tv_interval); |
5 |
|
6 |
use Koha::City; |
7 |
|
8 |
my $schema = Koha::Database->schema; |
9 |
$schema->txn_begin; |
10 |
|
11 |
my $city = Koha::City->new( { city_name => 'Marseille' } ); |
12 |
$city->store; |
13 |
my $t0 = [gettimeofday]; |
14 |
|
15 |
my $n = 10_000; |
16 |
for ( 1 .. $n ) { |
17 |
$city->make_column_dirty('city_name'); |
18 |
$city->store; |
19 |
} |
20 |
|
21 |
my $elapsed = tv_interval( $t0, [gettimeofday] ); |
22 |
printf "Time for %d store (s): %.3f\n", $n, $elapsed; |
23 |
printf "Time per store (µs): %.3f\n", ($elapsed / $n) * 1_000_000; |
24 |
|
25 |
|
26 |
$schema->txn_rollback; |