The second method is a smidge faster, but not too much - and it does use one more variable, so really it's personal opinion.
Once the module has been loaded it's 'cached' and subsequent calls to require("module") will just do a lookup, so it's not like the whole thing is being loaded in each time.
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.
The second method is a smidge faster, but not too much - and it does use one more variable, so really it's personal opinion.
Once the module has been loaded it's 'cached' and subsequent calls to
require("module")
will just do a lookup, so it's not like the whole thing is being loaded in each time.