[Rt-devel] [PATCH] Quote identifiers.

Jesse Vincent jesse at bestpractical.com
Fri Jan 28 10:36:07 EST 2005


Thanks. Applied.


On Sun, Jan 23, 2005 at 01:54:30AM +0300, Ruslan U. Zakirov wrote:
> 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.
> >>
> >
> >
> 



-- 


More information about the Rt-devel mailing list