Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
facebook-benchmark
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alan Farquharson
facebook-benchmark
Commits
cc2fd64f
Commit
cc2fd64f
authored
Jul 16, 2018
by
Alan Farquharson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
0 deletions
+100
-0
array.php
array.php
+34
-0
bindvalue.php
bindvalue.php
+33
-0
placeholders.php
placeholders.php
+33
-0
No files found.
array.php
0 → 100644
View file @
cc2fd64f
<?php
$host
=
'127.0.0.1'
;
$db
=
'test'
;
$user
=
'root'
;
$pass
=
''
;
$charset
=
'utf8mb4'
;
$dsn
=
"mysql:host=
$host
;dbname=
$db
;charset=
$charset
"
;
$opt
=
[
PDO
::
ATTR_ERRMODE
=>
PDO
::
ERRMODE_EXCEPTION
,
PDO
::
ATTR_DEFAULT_FETCH_MODE
=>
PDO
::
FETCH_ASSOC
,
PDO
::
ATTR_EMULATE_PREPARES
=>
false
,
];
$pdo
=
new
PDO
(
$dsn
,
$user
,
$pass
,
$opt
);
$current
=
new
DateTime
();
$end
=
new
DateTime
(
'+1 minute'
);
$count
=
0
;
while
(
$current
<
$end
)
{
$query
=
'SELECT * FROM `example` WHERE id = ? and `name` = ?'
;
$stmt
=
$pdo
->
prepare
(
$query
);
$args
=
[
1
=>
1
,
2
=>
'Alan'
];
$stmt
->
execute
(
$args
);
$fetched
=
$stmt
->
fetch
();
$count
++
;
$current
=
new
DateTime
();
}
echo
'I managed to do '
.
number_format
(
$count
)
.
' queries in 60 seconds'
.
PHP_EOL
;
bindvalue.php
0 → 100644
View file @
cc2fd64f
<?php
$host
=
'127.0.0.1'
;
$db
=
'test'
;
$user
=
'root'
;
$pass
=
''
;
$charset
=
'utf8mb4'
;
$dsn
=
"mysql:host=
$host
;dbname=
$db
;charset=
$charset
"
;
$opt
=
[
PDO
::
ATTR_ERRMODE
=>
PDO
::
ERRMODE_EXCEPTION
,
PDO
::
ATTR_DEFAULT_FETCH_MODE
=>
PDO
::
FETCH_ASSOC
,
PDO
::
ATTR_EMULATE_PREPARES
=>
false
,
];
$pdo
=
new
PDO
(
$dsn
,
$user
,
$pass
,
$opt
);
$current
=
new
DateTime
();
$end
=
new
DateTime
(
'+1 minute'
);
$count
=
0
;
while
(
$current
<
$end
)
{
$query
=
'SELECT * FROM `example` WHERE id = ? and `name` = ?'
;
$stmt
=
$pdo
->
prepare
(
$query
);
$stmt
->
execute
([
1
=>
1
,
2
=>
'Alan'
]);
$fetched
=
$stmt
->
fetch
();
$count
++
;
$current
=
new
DateTime
();
}
echo
'I managed to do '
.
number_format
(
$count
)
.
' queries in 60 seconds'
.
PHP_EOL
;
placeholders.php
0 → 100644
View file @
cc2fd64f
<?php
$host
=
'127.0.0.1'
;
$db
=
'test'
;
$user
=
'root'
;
$pass
=
''
;
$charset
=
'utf8mb4'
;
$dsn
=
"mysql:host=
$host
;dbname=
$db
;charset=
$charset
"
;
$opt
=
[
PDO
::
ATTR_ERRMODE
=>
PDO
::
ERRMODE_EXCEPTION
,
PDO
::
ATTR_DEFAULT_FETCH_MODE
=>
PDO
::
FETCH_ASSOC
,
PDO
::
ATTR_EMULATE_PREPARES
=>
false
,
];
$pdo
=
new
PDO
(
$dsn
,
$user
,
$pass
,
$opt
);
$current
=
new
DateTime
();
$end
=
new
DateTime
(
'+1 minute'
);
$count
=
0
;
while
(
$current
<
$end
)
{
$query
=
'SELECT * FROM `example` WHERE id = :id and `name` = :name'
;
$stmt
=
$pdo
->
prepare
(
$query
);
$stmt
->
execute
([
'id'
=>
1
,
'name'
=>
'Alan'
]);
$fetched
=
$stmt
->
fetch
();
$count
++
;
$current
=
new
DateTime
();
}
echo
'I managed to do '
.
number_format
(
$count
)
.
' queries in 60 seconds'
.
PHP_EOL
;
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