This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test(size, iterations) { | |
let data_array = []; | |
let data_obj = {}; | |
for (let i = 0; i < size; i++) { | |
let rnd = Math.floor(Math.random() * size * 10); | |
data_array.push(rnd); | |
data_obj[rnd] = true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
import time | |
# fetch python version string | |
version = str(sys.version).split(" ", 2)[0] | |
# define get_time() function | |
if sys.version_info.major == 3: | |
def get_time(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_concat($size) | |
{ | |
$result = ""; | |
for ($i = 0; $i < $size; $i++) { | |
$result .= (string)rand() . "\n"; | |
} | |
return $result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Binary search - search element in sorted array of values and return true/false | |
* | |
* @param $value | |
* @param $array array | |
* @return bool | |
*/ | |
function in_array_binary($value, array &$array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function test($size) | |
{ | |
// prepare arrays | |
$plain = []; | |
for ($i = 0; $i < $size; $i++) { | |
$value = rand(); | |
array_push($plain, $value); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function test($size, $iterations) | |
{ | |
// prepare arrays | |
$plain = []; | |
$assoc = []; | |
for ($i = 0; $i < $size; $i++) { | |
$value = rand(); | |
array_push($plain, $value); |