forked from rosebudai/OpenRCT2-Web
Previously JS entities would create prototypes on each allocation in `Sc*::New`. This change creates a single global protype for each entity class which then gets copied upon entity allocation in JS realm. Running test with "Live Ride Measurements" plugin on a park shared for performance testing I get following results: | | OpenRCT2::Scripting::HookEngine::Call | OpenRCT2::Scripting::ScMap::getAllEntities | |-----------------|---------------------------------------|--------------------------------------------| | duktape | 68ms | 10ms | | quickjs current | 318ms | 126ms | | quickjs + fix | 22ms | 942µs | Previously each call to `getAllEntities` would result in 1382 calls to `JS_SetPropertyFunctionList`, each costing 90.5µs. Park used: https://files.catbox.moe/z6j2g4.park
This commit is contained in:
1 parent
b6d1f6e4cb
commit
8d9aec1090
21 files changed
+194
-88
No files matched your search
@@ -30,9 +30,14 @@
|
||||
#include "../platform/Platform.h"
|
||||
#include "../profiling/Profiling.h"
|
||||
#include "../ride/ted/PitchAndRoll.h"
|
||||
#include "bindings/entity/ScBalloon.hpp"
|
||||
#include "bindings/entity/ScEntity.hpp"
|
||||
#include "bindings/entity/ScGuest.hpp"
|
||||
#include "bindings/entity/ScLitter.hpp"
|
||||
#include "bindings/entity/ScMoneyEffect.hpp"
|
||||
#include "bindings/entity/ScParticle.hpp"
|
||||
#include "bindings/entity/ScStaff.hpp"
|
||||
#include "bindings/entity/ScVehicle.hpp"
|
||||
#include "bindings/game/ScCheats.hpp"
|
||||
#include "bindings/game/ScConsole.hpp"
|
||||
#include "bindings/game/ScContext.hpp"
|
||||
@@ -573,6 +578,17 @@ void ScriptEngine::RegisterClasses(JSContext* ctx)
|
||||
gScTrackIterator.Register(ctx);
|
||||
gScTrackSegment.Register(ctx);
|
||||
gScEntity.Register(ctx);
|
||||
gScPeep.Register(ctx);
|
||||
gScGuest.Register(ctx);
|
||||
gScStaff.Register(ctx);
|
||||
gScHandyman.Register(ctx);
|
||||
gScMechanic.Register(ctx);
|
||||
gScSecurity.Register(ctx);
|
||||
gScBalloon.Register(ctx);
|
||||
gScLitter.Register(ctx);
|
||||
gScMoneyEffect.Register(ctx);
|
||||
gScCrashedVehicleParticle.Register(ctx);
|
||||
gScVehicle.Register(ctx);
|
||||
gScThought.Register(ctx);
|
||||
#ifndef DISABLE_NETWORK
|
||||
gScSocket.Register(ctx);
|
||||
@@ -615,6 +631,17 @@ void ScriptEngine::UnregisterClasses()
|
||||
gScTrackIterator.Unregister();
|
||||
gScTrackSegment.Unregister();
|
||||
gScEntity.Unregister();
|
||||
gScPeep.Unregister();
|
||||
gScGuest.Unregister();
|
||||
gScStaff.Unregister();
|
||||
gScHandyman.Unregister();
|
||||
gScMechanic.Unregister();
|
||||
gScSecurity.Unregister();
|
||||
gScBalloon.Unregister();
|
||||
gScLitter.Unregister();
|
||||
gScMoneyEffect.Unregister();
|
||||
gScCrashedVehicleParticle.Unregister();
|
||||
gScVehicle.Unregister();
|
||||
gScThought.Unregister();
|
||||
#ifndef DISABLE_NETWORK
|
||||
gScSocket.Unregister();
|
||||
|
||||
Reference in new issue
Block a user