[Rt-devel] [PATCH] Quote identifiers.
Ruslan U. Zakirov
Ruslan.Zakirov at acronis.com
Sat Jan 22 17:54:30 EST 2005
Jesse Vincent wrote:
>
>>Speed. See next benchmark
>
>
> At the expense of clarity. I hate perl's method dispatch
> performance. Will you update the patch with a comment about _why_
> you're doing something that looks like it should be optimized away so
> that someone else doesn't "fix" it?
I resubmit patch where thing looks like you want. Done more complex test
that insert 5000 records into SQLite DB. Same time results for both
variants.
>>#!/usr/bin/perl -w
>>
>>
>>
>>use strict;
>>use Benchmark qw(cmpthese);
>>my $obj = new Dummy;
>>
>>
>>
>>cmpthese (-6, {
>> 'with $dbh' => sub { $obj->w_cache(); },
>> 'without $dbh' => sub { $obj->wo_cache() },
>> });
>>
>>
>>
>>package Dummy;
>>
>>
>>
>>sub new { return bless { dbh => { foo => 'bar' } }, 'Dummy' }
>>sub dbh { my $self = shift; return $self->{'dbh'} }
>>
>>
>>
>>sub w_cache {
>> my $self = shift;
>> my $dbh = $self->dbh;
>> for(1..5) { my $x = $dbh->{foo} }
>>}
>>sub wo_cache {
>> my $self = shift;
>> for(1..5) {my $x = $self->dbh->{foo} }
>>}
>>Results:
>> Rate without $dbh with $dbh
>>without $dbh 43465/s -- -40%
>>with $dbh 72127/s 66% --
>>
>>Something similar happens in sub Insert I call quote_identifier in map
>>context for each column, also dbh sub in SB::Handle more complex then in
>>benchmark.
>>
>>Similar situation in UpdateRecordValue.
>>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quote_identifier.patch
Type: application/aegis-patch
Size: 1245 bytes
Desc: not available
Url : http://bestpractical.com/pipermail/rt-devel/attachments/20050123/6d47fbc8/quote_identifier-0001.bin
More information about the Rt-devel
mailing list