Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 54 lines 1.5 kB view raw
1<!doctype html> 2<html lang="en"> 3 <head> 4 <meta charset="UTF-8" /> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 6 <title>5000 Writes</title> 7 <script> 8 window.process = { env: { NODE_ENV: 'development' } }; 9 </script> 10 </head> 11 12 <body> 13 <div id="root"></div> 14 <script type="module"> 15 import urqlClient from './urqlClient.js'; 16 import * as bench from '/bench.js'; 17 import { makeEntries } from './makeEntries.js'; 18 import { 19 makeTodo, 20 makeWriter, 21 makeBook, 22 makeStore, 23 makeEmployee, 24 } from './entities.js'; 25 import { 26 getAllTodos, 27 addTodos, 28 addWriters, 29 addBooks, 30 addStores, 31 addEmployees, 32 } from './benchmarks.js'; 33 34 // create entities to be written 35 const thousandTodos = makeEntries(1000, makeTodo); 36 const thousandWriters = makeEntries(1000, makeWriter); 37 const thousandBooks = makeEntries(1000, makeBook); 38 const thousandStores = makeEntries(1000, makeStore); 39 const thousandEmployees = makeEntries(1000, makeEmployee); 40 41 const benchmark = async () => { 42 bench.start(); 43 await addTodos(thousandTodos); 44 await addWriters(thousandWriters); 45 await addBooks(thousandBooks); 46 await addStores(thousandStores); 47 await addEmployees(thousandEmployees); 48 bench.stop(); 49 }; 50 51 benchmark(); 52 </script> 53 </body> 54</html>