From: Peter Rabbitson Date: Wed, 4 Nov 2015 03:18:01 +0000 (+0100) Subject: Add changelog entry on 90c9dd1d, 757891ed and 89203568 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df9da3541a831d9333c9eccb058e40e905a4b3c6;p=dbsrgits%2FDBIx-Class-Historic.git Add changelog entry on 90c9dd1d, 757891ed and 89203568 Sample (not ideal - could be *SO* much better ) timings from included bencher: Before (0.0828xx): 62951 byte-long query generated (via as_query()) in: 4.975237 seconds (take 1) 62951 byte-long query generated (via as_query()) in: 4.995723 seconds (take 2) 62951 byte-long query generated (via as_query()) in: 4.964793 seconds (take 3) 62951 byte-long query generated (via as_query()) in: 4.96168 seconds (take 4) 62951 byte-long query generated (via as_query()) in: 4.991396 seconds (take 5) 62951 byte-long query generated (via as_query()) in: 4.988478 seconds (take 6) 62951 byte-long query generated (via as_query()) in: 4.977612 seconds (take 7) 62951 byte-long query generated (via as_query()) in: 4.98648 seconds (take 8) 62951 byte-long query generated (via as_query()) in: 4.999984 seconds (take 9) After: 62951 byte-long query generated (via as_query()) in: 0.429634 seconds (take 1) 62951 byte-long query generated (via as_query()) in: 0.416169 seconds (take 2) 62951 byte-long query generated (via as_query()) in: 0.430782 seconds (take 3) 62951 byte-long query generated (via as_query()) in: 0.416879 seconds (take 4) 62951 byte-long query generated (via as_query()) in: 0.426492 seconds (take 5) 62951 byte-long query generated (via as_query()) in: 0.428975 seconds (take 6) 62951 byte-long query generated (via as_query()) in: 0.413018 seconds (take 7) 62951 byte-long query generated (via as_query()) in: 0.428731 seconds (take 8) 62951 byte-long query generated (via as_query()) in: 0.413206 seconds (take 9) --- diff --git a/Changes b/Changes index c1faad9..5eecbe8 100644 --- a/Changes +++ b/Changes @@ -31,6 +31,8 @@ Revision history for DBIx::Class * New Features - InflateColumn::DateTime now accepts the ecosystem-standard option 'time_zone', in addition to the DBIC-only 'timezone' (GH#28) + - Massively optimised literal SQL snippet scanner - fixes all known + slowdowns ( in some cases 50x ) of very complex prefetch/selects - DBIx::Class::Optional::Dependencies now properly understands combinations of requirements and does the right thing with e.g. ->req_list_for([qw( rdbms_oracle ic_dt )]) bringing in the Oracle diff --git a/examples/Benchmarks/benchmark_join_optimizer.pl b/examples/Benchmarks/benchmark_join_optimizer.pl new file mode 100755 index 0000000..68b4a50 --- /dev/null +++ b/examples/Benchmarks/benchmark_join_optimizer.pl @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Time::HiRes qw(gettimeofday tv_interval); +use Digest::SHA 'sha1_hex'; + +use lib 't/lib'; +BEGIN { $ENV{DBICTEST_ANFANG_DEFANG} = 1 }; +use DBICTest; + +my $schema = DBICTest->init_schema( + quote_names => 1, + cursor_class => 'DBIx::Class::Cursor::Cached' +); + +use Cache::FileCache; +my $c = Cache::FileCache->new({ namespace => 'SchemaClass' }); + +for my $i (1..9) { + + my $t0 = [gettimeofday]; + + # getting a fresh rs makes sure we do not cache anything + my $rs = $schema->resultset("Artist")->search({},{ + cache_object => $c, + cache_for => 999999999999, + prefetch => { + cds => [ + ( { tracks => { cd_single => { artist => { cds => { tracks => 'cd_single' } } } } } ) x 50, + ], + }, + rows => 2, + }); + + my $q = ${$rs->as_query}->[0]; + + print STDERR "@{[ length $q]} byte-long query generated (via as_query() in: ".tv_interval($t0) . " seconds (take $i)\n"; + + # stuff below can be made even faster, but another time + next; + + $t0 = [ gettimeofday ]; + + my $x = $rs->all_hri; + print STDERR "Got collapsed results (via HRI) in: ".tv_interval($t0) . " seconds (take $i)\n"; +}