From 22cb52cb4bc7b6486b8e7a7729b3ada286f8b6b7 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 7 Aug 2016 02:45:57 +0200 Subject: [PATCH] Improve createVehicle(Local) performance consideration description --- wiki/development/coding-guidelines.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wiki/development/coding-guidelines.md b/wiki/development/coding-guidelines.md index cdf9b52b254..b594b26adec 100644 --- a/wiki/development/coding-guidelines.md +++ b/wiki/development/coding-guidelines.md @@ -697,16 +697,17 @@ When adding multiple elements to an array, the binary addition may be used for t `createVehicle` array shall be used. ### 8.3. `createVehicle(Local)` position -`createVehicle(Local)` shall be used with `[0, 0, 0]` where possible due to performance (using any other position performs search for empty space to prevent collisions). +`createVehicle(Local)` used with a non-`[0, 0, 0]` position performs search for empty space to prevent collisions on spawn. +Where possible `[0, 0, 0]` position shall be used, except on `#` objects (e.g. `#lightsource`, `#soundsource`) where empty position search is not performed. -This code requires ~1.00ms: +This code requires ~1.00ms and will be higher with more objects near wanted position: ```js _vehicle = _type createVehicleLocal _posATL; _vehicle setposATL _posATL; ``` -While this one requires ~0.08ms: +While this one requires ~0.04ms: ```js _vehicle = _type createVehicleLocal [0, 0, 0];