ソースを参照

HW17 speedTest

maryluis 4 年 前
コミット
2af71d8d54
1 ファイル変更4 行追加4 行削除
  1. 4 4
      homework17/speedTest.html

+ 4 - 4
homework17/speedTest.html

@@ -46,8 +46,8 @@
            
             querySpeed = (count * parallel) / duration;
             queryDuration = duration / count;
-            parallelSpeed = (count * parallel) / duration;
-            parallelDuration = count / duration;
+            parallelSpeed = (count * parallel) / (duration / count);
+            parallelDuration = duration / (count * parallel);
 
                
             return {
@@ -59,7 +59,7 @@
             }
         }
 
-//speedtest(() => delay(1000), 10, 10 ).then(result => console.log(result));
+speedtest(() => delay(1000), 10, 10 ).then(result => console.log(result));
 // {duration: 10000, 
 // querySpeed: 0.001, //1 тысячная запроса за миллисекунду
 // queryDuration: 1000, //1000 миллисекунд на один реальный запрос в среднем 
@@ -67,7 +67,7 @@
 // parallelDuration: 100 // 100 запросов за 10000 миллисекунд
 //speedtest(() => fetch('http://swapi.dev/api/people/1').then(res => res.json()), 10, 5);
 
-speedtest(() => fetch('http://swapi.dev/api/people/1').then(res => res.json()), 10, 5).then(result => console.log(result));
+//speedtest(() => fetch('http://swapi.dev/api/people/1').then(res => res.json()), 10, 5).then(result => console.log(result));
 
     </script>
 </body>