From 81b4926f851a3a825506508ca3fc5b36385f8487 Mon Sep 17 00:00:00 2001 From: Anemy Date: Sun, 10 Jul 2022 12:01:19 -0400 Subject: [PATCH 1/2] util: remove unicode support todo for perf implications Follow up from benchmarks in pr: https://github.com/nodejs/node/pull/43721 --- lib/internal/util/inspect.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 25c4874e227dad..885664f6c367f0 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -1530,8 +1530,6 @@ function formatPrimitive(fn, value, ctx) { trailer = `... ${remaining} more character${remaining > 1 ? 's' : ''}`; } if (ctx.compact !== true && - // TODO(BridgeAR): Add unicode support. Use the readline getStringWidth - // function. value.length > kMinLineLength && value.length > ctx.breakLength - ctx.indentationLvl - 4) { return value From b8f3e6bcbb28e1ca61c0c774e159e2ac81c5b8ab Mon Sep 17 00:00:00 2001 From: Anemy Date: Mon, 11 Jul 2022 10:06:14 -0400 Subject: [PATCH 2/2] add comment on unicode character performance implications --- lib/internal/util/inspect.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 885664f6c367f0..01b7f414a7dd2f 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -1530,6 +1530,9 @@ function formatPrimitive(fn, value, ctx) { trailer = `... ${remaining} more character${remaining > 1 ? 's' : ''}`; } if (ctx.compact !== true && + // We do not support handling unicode characters width with + // the readline getStringWidth function as there are + // performance implications. value.length > kMinLineLength && value.length > ctx.breakLength - ctx.indentationLvl - 4) { return value