I’m trying to figure out if in my case it makes sense to use the High-performance JavaScript callback handler module. Between js/MODULE/example.json (hook_js()
) and example.json (hook_menu()
), the difference of time is not huge, but I think hook_js()
is faster.
In a case I’m not using any Drupal function, variable or session, and I’m only calling another server with REST. Can I bypass all the bootstrap functions, or do I have to use the first layer (DRUPAL_BOOTSTRAP_CONFIGURATION
)?
What would be the faster solution?
function MODULE_js(){ return array( // Example URL is /js/MODULE/example.json 'example.json' => array( 'callback' => 'my_json', 'includes' => array('unicode', 'locale', 'language'), 'dependencies' => array(), 'bootstrap' => DRUPAL_BOOTSTRAP_CONFIGURATION, 'access callback' => 'access_callback', 'access arguments' => array(), 'page arguments' => array(), 'skip_hook_init' => TRUE, 'delivery callback' => 'drupal_json_output', ), ); } function access_callback (){ return true; } function MODULE_menu() $items['example.json'] = array( 'type' => MENU_CALLBACK, 'page callback' => 'my_json', 'page arguments' => array(), 'access callback' => true, 'delivery callback' => 'drupal_json_output', ); return $items; } function my_json(){ //call with curl/rest and return a json return 'json'; }