You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using inline functions for conditional logging take 2-3x more time than unconditionally building strings.
Looks like the function parameter style does not provide the intended performance benefits, see visgl/deck.gl#3949
Proposals:
modify the various log calls to take multiple string segment as parameters and concat them inside the log functions when logging actually happens. That should create no objects and parameter passing is really fast in modern JS engines.
consider dropping the function parameter feature from probe if it does not provide expected performance benefits (throw or warn if function parameter is passed).
log.info(() => `releasing ${id}`) // old, expensive inline function with variable capture
log.info(`releasing `, id) // new, fast parameter passing, string concatenation happens only of logging enabled.
The text was updated successfully, but these errors were encountered:
ibgreen
changed the title
using inline functions for conditional logging take 2-3x more time than unconditionally building strings.
Deprecate log message function syntax in favor of concatenation of params
Dec 5, 2019
My point is that 90% of use cases for dynamic log messages is just to concatenate a variable or two into the message, and that can be handled by instead just passing them as bunch of params, which I would expect to be very fast.
The main change called out by this issue is that we would do string concatenation instead of just passing those params as extra args to the corresponding console.log type function, this is mainly to let us control the way things are output, rather than leave it to the browser's implementation of console.log and friends.
(Though as I am testing it now in the Chrome debugger, it actually already looks pretty good the way the debugger prints those args.)
Looks like the function parameter style does not provide the intended performance benefits, see visgl/deck.gl#3949
Proposals:
The text was updated successfully, but these errors were encountered: