EclairJS / eclairjs-nashorn

JavaScript API for Apache Spark
Apache License 2.0
94 stars 11 forks source link

change logging mechanism #268

Open pberkland opened 8 years ago

pberkland commented 8 years ago

The current logging mechanism has huge performance impacts.
When something is done like "logger.debug('functionName -'+parmValue)"
this goes thru the expensive nashorn ADD function (to concatenate the string) before it is even determined if the logger is logging at that level. For the examples/mllib/largedataset.js example, it take 100s when logging is on in the Serialize.js, and only 50s when the logging is commented out.

We probably want something like "logger.debug('functionName',parmvalue)" and then within the logger implementation, first check if it is at the correct logging level, and if it is, do a string.join on the log parameters.

billreed63 commented 8 years ago

This may help but if the problem is string concatenation we have that throughout our code fro example

var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger');
doronrosenberg commented 8 years ago

Is String.concat() in Nashorn any faster than using the + operator?