I had a habit of requiring all my node modules in the beginning of the app.js file.
var express=require('express'),
bodyParser = require( 'body-parser' ),
cookieParser = require( 'cookie-parser' ),
compression = require( 'compression' ),
.
.
But some modules are used for single jobs in a single function, so I can remove those from the beginning and place them inline.
var express=require('express'),
bodyParser = require( 'body-parser' ),
cookieParser = require( 'cookie-parser' ),
compression = require( 'compression' ),
.
.
function myfunc(){
require( 'https' ).get( "https://www.google.com/recaptcha/api/siteverify?secret= ......
.
.
instead of
var express=require('express'),
bodyParser = require( 'body-parser' ),
cookieParser = require( 'cookie-parser' ),
compression = require( 'compression' ),
https=require('https'),
.
.
function myfunc(){
https.get( "https://www.google.com/recaptcha/api/siteverify?secret= ......
.
.
My question: Which of these gives better performance?