diff options
author | 2023-01-04 03:30:15 -0800 | |
---|---|---|
committer | 2023-01-04 03:30:15 -0800 | |
commit | 4a328609b96609dbeb8dc98e19aa2f52d2e5eaab (patch) | |
tree | 36d16a77ab44f3b324e3508b6a3e9f4daecf9df2 /src/bun.js/bindings/JSStringDecoder.cpp | |
parent | 021331f154123f9fb39ac47d5c98f5a9e1095ea4 (diff) | |
download | bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.tar.gz bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.tar.zst bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.zip |
10x faster `new Buffer` (#1717)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/JSStringDecoder.cpp')
-rw-r--r-- | src/bun.js/bindings/JSStringDecoder.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/bun.js/bindings/JSStringDecoder.cpp index a2872b994..66f9cb654 100644 --- a/src/bun.js/bindings/JSStringDecoder.cpp +++ b/src/bun.js/bindings/JSStringDecoder.cpp @@ -364,8 +364,8 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi auto throwScope = DECLARE_THROW_SCOPE(vm); JSStringDecoder* thisObject = jsCast<JSStringDecoder*>(JSValue::decode(thisValue)); auto buffer = ArrayBuffer::createFromBytes(thisObject->m_lastChar, 4, nullptr); - JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, true), WTFMove(buffer), 0, 4); - toBuffer(lexicalGlobalObject, uint8Array); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, 4); RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array)); } static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) |