Is there a more efficient way to get current time into same variable instance?
It's really not that bad... I think allocating Date uses 3 variables, and because of the way Espruino works that's pretty quick and not likely to cause any fragmentation.
You can do D.setTime(Date.now()) but I think it's of such a marginal improvement it's not worth it.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, that's right! Good detective work :)
It's really not that bad... I think allocating
Date
uses 3 variables, and because of the way Espruino works that's pretty quick and not likely to cause any fragmentation.You can do
D.setTime(Date.now())
but I think it's of such a marginal improvement it's not worth it.