Skip to content

Commit afdb5ec

Browse files
committed
Don't try to revive buffers
We can safely skip reviving these objects (which is quite expensive) since they only contain numbers
1 parent ba6576d commit afdb5ec

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/vs/base/common/marshalling.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { URI } from 'vs/base/common/uri';
77
import { regExpFlags } from 'vs/base/common/strings';
8+
import { VSBuffer } from 'vs/base/common/buffer';
89

910
export function stringify(obj: any): string {
1011
return JSON.stringify(obj, replacer);
@@ -44,6 +45,13 @@ export function revive(obj: any, depth = 0): any {
4445
case 2: return new RegExp(obj.source, obj.flags);
4546
}
4647

48+
if (
49+
obj instanceof VSBuffer
50+
|| obj instanceof Uint8Array
51+
) {
52+
return obj;
53+
}
54+
4755
// walk object (or array)
4856
for (let key in obj) {
4957
if (Object.hasOwnProperty.call(obj, key)) {

0 commit comments

Comments
 (0)