Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

71 linhas
1.6KB

  1. const cpp_code = `
  2. #include <cheerp/client.h>
  3. #include <cheerp/clientlib.h>
  4. class [[cheerp::jsexport]] JsBridge
  5. {
  6. public:
  7. JsBridge() = default;
  8. void test()
  9. {
  10. volatile size_t counter = 0;
  11. for (int i = 0; i < 100000; ++i) {
  12. for (int j = 0; j < 10000; ++j) {
  13. counter++;
  14. }
  15. }
  16. }
  17. };
  18. void webMain() {}
  19. `.trim();
  20. const html_code = `
  21. <html>
  22. <head>
  23. <script>
  24. function test() {
  25. counter = 0
  26. for (i = 0; i < 100000; ++i) {
  27. for (j = 0; j < 10000; ++j) {
  28. counter++;
  29. }
  30. }
  31. }
  32. setTimeout(function() {
  33. var jsBridge = new JsBridge();
  34. {
  35. var start = new Date().getTime();
  36. test();
  37. var time = new Date().getTime() - start;
  38. document.getElementById('output').innerHTML += "Javascript execution time:" + time + "<br>";
  39. }
  40. {
  41. var start = new Date().getTime();
  42. jsBridge.test();
  43. var time = new Date().getTime() - start;
  44. document.getElementById('output').innerHTML += "Compiled JS execution time:" + time + "<br>";
  45. }
  46. return false;
  47. }, 500);
  48. </script>
  49. </head>
  50. <body id="output">
  51. </body>
  52. </html>`.trim();
  53. const js_code = ``.trim();
  54. const flags = `
  55. -cheerp-pretty-code
  56. -cheerp-no-type-optimizer
  57. -cheerp-no-native-math
  58. -cheerp-no-math-imul
  59. -cheerp-no-math-fround
  60. -O3
  61. -target cheerp`.trim()
  62. const wasm_code = '';
  63. export const perf_example = { cpp: cpp_code, js: js_code, wasm: wasm_code, html: html_code, flags: flags }