Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
a368726f
Commit
a368726f
authored
Oct 21, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed/not used/outdated.
parent
e08f9113
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
142 deletions
+0
-142
mixin.php
benchmark/mixin.php
+0
-69
query_cache.php
benchmark/query_cache.php
+0
-73
No files found.
benchmark/mixin.php
deleted
100644 → 0
View file @
e08f9113
<?php
function
mixin
(
$tpl
,
$method
=
null
)
{
static
$_map
;
if
(
!
isset
(
$_map
[
$tpl
.
$method
]))
{
if
(
$method
===
null
)
{
$refl
=
new
ReflectionFunction
(
$tpl
);
}
else
{
$refl
=
new
ReflectionMethod
(
$tpl
,
$method
);
}
$lines
=
file
(
$refl
->
getFileName
());
$start
=
$refl
->
getStartLine
();
$end
=
$refl
->
getEndLine
();
$ret
=
array_slice
(
$lines
,
$start
,
(
$end
-
$start
));
$code
=
trim
(
trim
(
implode
(
' '
,
$ret
)),
'{}'
);
$_map
[
$tpl
.
$method
]
=
$code
;
}
else
{
$code
=
$_map
[
$tpl
.
$method
];
}
eval
(
$code
);
}
function
someCode
()
{
$a
=
10
;
}
class
Template
{
public
function
exec
()
{
$a
=
10
;
}
}
print
"<pre>MIXIN BENCHMARK
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
500
;
while
(
$i
--
)
{
mixin
(
'someCode'
);
}
print
'EXECUTED 500 CODE BLOCKS : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
500
;
while
(
$i
--
)
{
someCode
();
}
print
'EXECUTED 500 DIRECT FUNCTION CALLS : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
500
;
while
(
$i
--
)
{
eval
(
'$a = 10;'
);
}
print
'EXECUTED 500 DIRECT EVAL CALLS : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
benchmark/query_cache.php
deleted
100644 → 0
View file @
e08f9113
<?php
require_once
'../lib/Doctrine.php'
;
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
class
Entity
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'id'
,
'integer'
,
20
,
'autoincrement|primary'
);
$this
->
hasColumn
(
'name'
,
'string'
,
50
);
}
}
$dbh
=
new
Doctrine_Db
(
'sqlite:test.db'
);
$conn
=
Doctrine_Manager
::
getInstance
()
->
openConnection
(
$dbh
);
// initialize some entities
$coll
=
new
Doctrine_Collection
(
'Entity'
);
$i
=
10
;
while
(
$i
--
)
{
$coll
[
$i
]
->
name
=
'e '
.
$i
;
}
$coll
->
save
();
$conn
->
clear
();
print
"<pre>DQL BENCHMARK
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
100
;
$query
=
new
Doctrine_Query
();
$query
->
setOption
(
'resultSetCache'
,
new
Doctrine_Cache_Array
());
while
(
$i
--
)
{
$query
->
from
(
'Entity e'
)
->
where
(
'e.id > 0'
);
$coll
=
$query
->
execute
(
array
(),
Doctrine
::
FETCH_ARRAY
);
}
print
'EXECUTED 100 QUERIES WITH CACHING ENABLED + FETCH_ARRAY : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
100
;
while
(
$i
--
)
{
$query
=
new
Doctrine_Query
();
$query
->
from
(
'Entity e'
)
->
where
(
'e.id > 0'
);
$coll
=
$query
->
execute
(
array
(),
Doctrine
::
FETCH_ARRAY
);
}
print
'EXECUTED 100 QUERIES WITHOUT CACHING + FETCH_ARRAY : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
100
;
$query
=
new
Doctrine_Query
();
$query
->
setOption
(
'resultSetCache'
,
new
Doctrine_Cache_Array
());
while
(
$i
--
)
{
$query
->
from
(
'Entity e'
)
->
where
(
'e.id > 0'
);
$coll
=
$query
->
execute
();
}
print
'EXECUTED 100 QUERIES WITH CACHING ENABLED + FETCH_RECORD : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
$timepoint
=
microtime
(
true
);
$i
=
100
;
while
(
$i
--
)
{
$query
=
new
Doctrine_Query
();
$query
->
from
(
'Entity e'
)
->
where
(
'e.id > 0'
);
$coll
=
$query
->
execute
();
}
print
'EXECUTED 100 QUERIES WITHOUT CACHING + FETCH_RECORD : '
.
(
microtime
(
true
)
-
$timepoint
)
.
"
\n
"
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment