From 742b304ea3f38fbbc63191b87d424abf353a2d4d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 20 Dec 2017 07:50:47 -0800 Subject: [PATCH] doc: warn about using util.inspect/util.format Because of the potential performance bottlenecks that may be introduced by `util.inspect()` and `util.format()` in production hot path code. Based on real user feedback, it is not obvious that these are intended to be debugging tools. PR-URL: https://github.com/nodejs/node/pull/17791 Reviewed-By: Ruben Bridgewater Reviewed-By: Matteo Collina --- doc/api/util.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/util.md b/doc/api/util.md index 77940425e1d226..c113561162d117 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -225,6 +225,11 @@ without any formatting. util.format('%% %s'); // '%% %s' ``` +Please note that `util.format()` is a synchronous method that is mainly +intended as a debugging tool. Some input values can have a significant +performance overhead that can block the event loop. Use this function +with care and never in a hot code path. + ## util.getSystemErrorName(err)