From e30f4e31247f21e27bc31ceaac588a373806a6ec Mon Sep 17 00:00:00 2001 From: xLuxy <67131061+xLuxy@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:21:46 +0100 Subject: [PATCH 1/2] chore(client): increase .all property performance by not creating a copy on an already frozen instance --- client/src/bindings/AudioOutput.cpp | 2 +- client/src/bindings/Player.cpp | 2 +- client/src/bindings/Vehicle.cpp | 2 +- shared/bindings/Blip.cpp | 2 +- shared/bindings/ColShape.cpp | 2 +- shared/bindings/Marker.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/bindings/AudioOutput.cpp b/client/src/bindings/AudioOutput.cpp index 3330b10e..d7585f38 100644 --- a/client/src/bindings/AudioOutput.cpp +++ b/client/src/bindings/AudioOutput.cpp @@ -19,7 +19,7 @@ static void AllAudioOutputGetter(v8::Local name, const v8::PropertyC { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllAudioOutputs()->Clone()); + V8_RETURN(resource->GetAllAudioOutputs()); } static void AudioOutputCountGetter(v8::Local name, const v8::PropertyCallbackInfo& info) diff --git a/client/src/bindings/Player.cpp b/client/src/bindings/Player.cpp index 78f84116..5587aecb 100644 --- a/client/src/bindings/Player.cpp +++ b/client/src/bindings/Player.cpp @@ -39,7 +39,7 @@ static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllPlayers()->Clone()); + V8_RETURN(resource->GetAllPlayers()); } static void CountGetter(v8::Local name, const v8::PropertyCallbackInfo& info) diff --git a/client/src/bindings/Vehicle.cpp b/client/src/bindings/Vehicle.cpp index 9c206b07..9c3a03ed 100644 --- a/client/src/bindings/Vehicle.cpp +++ b/client/src/bindings/Vehicle.cpp @@ -66,7 +66,7 @@ static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllVehicles()->Clone()); + V8_RETURN(resource->GetAllVehicles()); } static void CountGetter(v8::Local name, const v8::PropertyCallbackInfo& info) diff --git a/shared/bindings/Blip.cpp b/shared/bindings/Blip.cpp index d1fa896d..7bf394f1 100644 --- a/shared/bindings/Blip.cpp +++ b/shared/bindings/Blip.cpp @@ -199,7 +199,7 @@ static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllBlips()->Clone()); + V8_RETURN(resource->GetAllBlips()); } static void CountGetter(v8::Local name, const v8::PropertyCallbackInfo& info) diff --git a/shared/bindings/ColShape.cpp b/shared/bindings/ColShape.cpp index 36fc1d93..ecfbea6f 100644 --- a/shared/bindings/ColShape.cpp +++ b/shared/bindings/ColShape.cpp @@ -36,7 +36,7 @@ static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllColshapes()->Clone()); + V8_RETURN(resource->GetAllColshapes()); } static void StaticGetByID(const v8::FunctionCallbackInfo& info) diff --git a/shared/bindings/Marker.cpp b/shared/bindings/Marker.cpp index c2785546..8f728d46 100644 --- a/shared/bindings/Marker.cpp +++ b/shared/bindings/Marker.cpp @@ -33,7 +33,7 @@ static void AllGetter(v8::Local name, const v8::PropertyCallbackInfo { V8_GET_ISOLATE_CONTEXT_RESOURCE(); - V8_RETURN(resource->GetAllMarkers()->Clone()); + V8_RETURN(resource->GetAllMarkers()); } static void TypeGetter(v8::Local, const v8::PropertyCallbackInfo& info) From feafa53071d711faeb464cf2ec4fd0aa882decc6 Mon Sep 17 00:00:00 2001 From: xshady <54737754+xxshady@users.noreply.github.com> Date: Sat, 30 Mar 2024 18:13:27 +0300 Subject: [PATCH 2/2] fix(client): add missing assignment --- client/src/bindings/FocusData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/bindings/FocusData.cpp b/client/src/bindings/FocusData.cpp index a924db5d..9bd1f9cc 100644 --- a/client/src/bindings/FocusData.cpp +++ b/client/src/bindings/FocusData.cpp @@ -34,7 +34,7 @@ static void OverrideFocus(const v8::FunctionCallbackInfo& info) auto cls = V8Class::ObjectClass::NONE; if(info[0]->IsObject()) - V8Helpers::GetObjectClass(info[0].As()); + cls = V8Helpers::GetObjectClass(info[0].As()); if(cls == V8Class::ObjectClass::VECTOR3) {