Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Script start
- $rustart = getrusage();
- $a=array();
- //$j = new Judy(Judy::STRING_TO_MIXED);
- //$j = new Judy(Judy::INT_TO_INT);
- $j = new Judy(Judy::STRING_TO_INT);
- for ($i=0; $i<=15000; $i++){
- //12 секунд
- // $a['k'.$i]=$i;
- // $e = count($a);
- // $secondField = array_keys($a)[0];
- //400 мс.
- $j['k'.$i]=$i;
- $e = $j->count();
- $secondField = $j->first();
- }
- // Script end
- function rutime($ru, $rus, $index) {
- return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))
- - ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000));
- }
- $ru = getrusage();
- echo "This process used " . rutime($ru, $rustart, "utime") .
- " ms for its computations\n";
- echo "It spent " . rutime($ru, $rustart, "stime") .
- " ms in system calls\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement