Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* eslint-disable no-console */
  2. const { Suite } = require("benchmark");
  3. const { Listener } = require("./listener");
  4. const oldClarinet = require("clarinet");
  5. const newClarinet = require("..");
  6. const oldParser = oldClarinet.parser();
  7. const oldListener = new Listener(oldParser);
  8. const newParser = newClarinet.parser();
  9. const newListener = new Listener(newParser);
  10. const suites =
  11. ["creationix", "npm", "twitter", "wikipedia"]
  12. .map((name) => {
  13. // eslint-disable-next-line security/detect-non-literal-require
  14. return { name, json: JSON.stringify(require(`../samples/${name}.json`)) };
  15. });
  16. for (const { name, json } of suites) {
  17. new Suite("name")
  18. // Uncomment the below to add node's native JSON parsing to the results:
  19. // .add(`native-${name}`, () => JSON.parse(json))
  20. .add(`old-${name}`, () => {
  21. oldListener.reset();
  22. oldParser.write(json);
  23. oldParser.close();
  24. oldListener.check();
  25. })
  26. .add(`new-${name}`, () => {
  27. newListener.reset();
  28. newParser.write(json);
  29. newParser.close();
  30. newListener.check();
  31. })
  32. .on("cycle", (event) => {
  33. console.log(String(event.target));
  34. })
  35. .on("error", (event) => {
  36. console.error(String(event.target.error));
  37. })
  38. .on("complete", (event) => {
  39. console.log(
  40. `Fastest is ${event.currentTarget.filter("fastest").map("name")}\n`
  41. );
  42. })
  43. .run();
  44. }