Navigation Menu

Skip to content

Commit

Permalink
Update string benchmark script
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jul 11, 2012
1 parent 60677fd commit 30b4f40
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions benchmarks/string.php
Expand Up @@ -6,7 +6,8 @@
$bench->title = 'String';


$bench->iterate( 'concat' , 'string concat' , function() {
$bench->iterate( 'q_with_concat' , 'string concat' , function() {
$int = 4;
return 'select ' .
'ca.id as id,' .
'ca.start_time as start_time,' .
Expand All @@ -17,11 +18,12 @@
' where ' .
'ca.course_id = :course' . ' and ' .
'pa.id = ca.paid_id' . ' and ' .
'pa.state != 4' . ' and ' .
'pa.state != ' . $int . ' and ' .
'ca.date = :date';
});

$bench->iterate( 'qq' , 'string without concat' , function() {
$bench->iterate( 'qq_with_concat' , 'double quotes string without concat' , function() {
$int = 4;
return "select
ca.id as id,
ca.start_time as start_time,
Expand All @@ -32,11 +34,11 @@
where
ca.course_id = :course and
pa.id = ca.paid_id and
pa.state != 4' . ' and
pa.state != " . $int . " and
ca.date = :date";
});

$bench->iterate( 'qq_intp' , 'string without concat' , function() {
$bench->iterate( 'qq_interpolation' , 'string without concat' , function() {
$int = 4;
return "select
ca.id as id,
Expand All @@ -48,11 +50,11 @@
where
ca.course_id = :course and
pa.id = ca.paid_id and
pa.state != $int' . ' and
pa.state != $int and
ca.date = :date";
});

$bench->iterate( 'non_concat' , 'string without concat' , function() {
$bench->iterate( 'q' , 'string without concat' , function() {
return 'select
ca.id as id,
ca.start_time as start_time,
Expand All @@ -63,7 +65,7 @@
where
ca.course_id = :course and
pa.id = ca.paid_id and
pa.state != 4' . ' and
pa.state != $int and
ca.date = :date';
});

Expand Down

0 comments on commit 30b4f40

Please sign in to comment.