webassembly: Use Date's now() instead of getTime().

Using now() is a bit faster because it doesn't need to create a new Date.

Signed-off-by: Damien George <damien@micropython.org>
pull/9752/head
Damien George 2022-11-03 17:34:59 +11:00
rodzic 49ce93eeec
commit d65edaa232
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ mergeInto(LibraryManager.library, {
},
mp_js_ticks_ms: function() {
return (new Date()).getTime() - MP_JS_EPOCH;
return Date.now() - MP_JS_EPOCH;
},
mp_js_hook: function() {

Wyświetl plik

@ -33,7 +33,7 @@ var mainProgram = function()
mp_js_init_repl = Module.cwrap('mp_js_init_repl', 'null', ['null']);
mp_js_process_char = Module.cwrap('mp_js_process_char', 'number', ['number']);
MP_JS_EPOCH = (new Date()).getTime();
MP_JS_EPOCH = Date.now();
if (typeof window === 'undefined' && require.main === module) {
var fs = require('fs');