View | Details | Raw Unified | Return to bug 17015
Collapse All | Expand All

(-)a/tmp/DiscreteCalendar_performance/README.txt (+1 lines)
Line 0 Link Here
1
The performance tests were done using Devel::NYTProf - Powerful fast feature-rich Perl source code profiler.
(-)a/tmp/DiscreteCalendar_performance/benchmark_checkins.pl (+59 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
use DateTime;
4
5
use C4::Biblio;
6
use C4::Circulation;
7
use C4::Items;
8
use C4::Members;
9
use Koha::Database;
10
use Data::Dumper;
11
12
my $schema = Koha::Database->schema;
13
$schema->storage->txn_begin;
14
15
16
C4::Context->_new_userenv('xxx');
17
C4::Context->set_userenv(0,0,0,'firstname','surname', 'VC', 'Midway Public Library', '', '', '');
18
my $limit = 100;
19
my $dbh = C4::Context->dbh;
20
$dbh->do(q|DELETE FROM issues|);
21
22
my @items = $dbh->selectall_array("SELECT barcode FROM items WHERE barcode IS NOT NULL LIMIT $limit",  { Slice => {} });
23
my @borrowers = $dbh->selectall_array("SELECT borrowernumber FROM borrowers WHERE borrowernumber IS NOT NULL LIMIT $limit",  { Slice => {} });
24
25
############################
26
#       Checkouts
27
###########################
28
29
sub checkouts {
30
31
    for (my $i = 0; $i < $limit; $i++) {
32
        my $barcode = $items[$i]->{barcode};
33
        my $borrowernumber = $borrowers[$i]->{borrowernumber};
34
        my $borrower = GetMember( borrowernumber => $borrowernumber );
35
36
        my $due_date =  DateTime->new(year => 2016, month => 10, day => 1);
37
        # my $due_date =  DateTime->today;
38
        my $issuedate = DateTime->new(year => 2016, month => 7, day => 1);
39
40
        AddIssue( $borrower, $barcode, $due_date, undef, $issuedate, undef, undef );
41
    }
42
}
43
checkouts();
44
############################
45
#       Checkins
46
###########################
47
48
sub checkins {
49
50
    for (my $i = 0; $i < $limit; $i++) {
51
        my $barcode = $items[$i]->{barcode};
52
53
        AddReturn($barcode, undef, undef, undef, DateTime->today);
54
    }
55
}
56
checkins();
57
58
$schema->storage->txn_rollback;
59
1;
(-)a/tmp/DiscreteCalendar_performance/checkins/README.txt (+3 lines)
Line 0 Link Here
1
This tests include 100 checkouts.
2
First done where due date is today for the 100 issues, no delay.
3
Second was done where the 100 issues where due date was more 2 months ago.
(-)a/tmp/DiscreteCalendar_performance/checkout/README.txt (+4 lines)
Line 0 Link Here
1
First done when due date was today for the 100 issues.
2
Second was done when the 100 issues due date was than 2 months ago.
3
4
PS: Results should be the same whether it's today or 2 months ago, the difference is probably due to hardware use.a
(-)a/tmp/DiscreteCalendar_performance/fines.pl/README.txt (+1 lines)
Line 0 Link Here
1
This was done on 100 issues from a production database.

Return to bug 17015