@@ -1200,9 +1200,10 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) { |
|
|
1200 |
1200 |
output[i] = formatValue(ctx, entries[i], recurseTimes); |
1201 |
1201 |
} |
1202 |
1202 |
ctx.indentationLvl -= 2; |
1203 |
|
-if (state === kWeak) { |
|
1203 |
+if (state === kWeak && !ctx.sorted) { |
1204 |
1204 |
// Sort all entries to have a halfway reliable output (if more entries than |
1205 |
|
-// retrieved ones exist, we can not reliably return the same output). |
|
1205 |
+// retrieved ones exist, we can not reliably return the same output) if the |
|
1206 |
+// output is not sorted anyway. |
1206 |
1207 |
output = output.sort(); |
1207 |
1208 |
} |
1208 |
1209 |
const remaining = entries.length - maxLength; |
@@ -1227,9 +1228,11 @@ function formatMapIterInner(ctx, recurseTimes, entries, state) { |
|
|
1227 |
1228 |
output[i] = `${formatValue(ctx, entries[pos], recurseTimes)}` + |
1228 |
1229 |
` => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`; |
1229 |
1230 |
} |
1230 |
|
-// Sort all entries to have a halfway reliable output (if more entries |
1231 |
|
-// than retrieved ones exist, we can not reliably return the same output). |
1232 |
|
-output = output.sort(); |
|
1231 |
+// Sort all entries to have a halfway reliable output (if more entries than |
|
1232 |
+// retrieved ones exist, we can not reliably return the same output) if the |
|
1233 |
+// output is not sorted anyway. |
|
1234 |
+if (!ctx.sorted) |
|
1235 |
+output = output.sort(); |
1233 |
1236 |
} else { |
1234 |
1237 |
for (; i < maxLength; i++) { |
1235 |
1238 |
const pos = i * 2; |