Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5973695
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, Oct 3, 16:48 (7 h, 15 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ec/e4/86475a64820a1505cdf4d4e8a8d0
Default Alt Text
bench.php (822 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment