Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431301
bench.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
822 B
Referenced Files
None
Subscribers
None
bench.php
View Options
<?php
require_once
dirname
(
__DIR__
)
.
'/src/IPSet.php'
;
require_once
dirname
(
__DIR__
)
.
'/vendor/autoload.php'
;
use
Wikimedia\IPSet
;
$t
=
microtime
(
true
);
$ipsetPHP
=
new
IPSet
(
require
__DIR__
.
'/trusted-hosts.php'
);
$t
=
(
microtime
(
true
)
-
$t
)
*
1000
;
echo
"Load from PHP array and initialise: {$t}s
\n
"
;
checkIPs
(
$ipsetPHP
);
echo
"
\n
"
;
$t
=
microtime
(
true
);
$ipsetJSON
=
IPSet
::
newFromJson
(
file_get_contents
(
__DIR__
.
'/trusted-hosts.json'
)
);
$t
=
(
microtime
(
true
)
-
$t
)
*
1000
;
echo
"Load from serialized json and initialise: {$t}s
\n
"
;
checkIPs
(
$ipsetJSON
);
function
checkIPs
(
IPSet
$ipset
):
void
{
foreach
(
[
'69.63.176.1'
=>
true
,
'127.0.0.1'
=>
false
]
as
$ip
=>
$exists
)
{
if
(
$ipset
->
match
(
$ip
)
===
$exists
)
{
echo
"IPSet returned correct result for $ip
\n
"
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 20:17 (1 d, 1 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2a/53/0f73e1c3c4027c8e42bfdca4902c
Default Alt Text
bench.php (822 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment