Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve performance of namespace #619

Merged
merged 5 commits into from
Mar 18, 2017
Merged

improve performance of namespace #619

merged 5 commits into from
Mar 18, 2017

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Mar 17, 2017

When merged this pull request will:

  • After 1.68 update, the performance cost of rendering local CBA namespaces is higher if they are drawType = "name"; than they are with drawType = "area";, so we can change this to have a very slight performance boost with the map opened (becomes apparent with very large number of namespaces).

  • Map - FPS no local namespaces: 62-65 FPS

  • Map - 50k local namespaces before this PR: 14-15 FPS

  • Map - 50k local namespaces after this PR: 50 FPS

Additionally I now disable the simulation of the global namespaces via init eventhandler use simple objects for the global namespaces. (possible since they are OBJECT and not LOCATION).

  • No map, no namespaces: 80 72-75 FPS (65 on map)
  • 50k global namespaces before this PR: ~ 32 FPS (same on map)
  • 50k global namespaces after this PR: 77 59 FPS (same on map)

Local namespaces are drawn (LOCATION) while the map is opened, while global namespaces are always simulated (OBJECT). This explains why local namespaces have (almost) no effect on FPS when the map is closed, while they have a bigger one if the map is shown.

  • Code used to create 50k local namespaces:
for "_i" from 1 to 50000 do {
    private _newHash = call CBA_fnc_createNamespace;
    TEST pushBack _newHash;
};
  • Code used to create 50k global namespaces:
for "_i" from 1 to 50000 do {
    private _newHash = true call CBA_fnc_createNamespace;
    TEST pushBack _newHash;
};

Additionally, ACRE is using setText on the local namespace for no apparent reason. I suggest that they stop doing that, since that cuts the FPS in half with 50k local namespaces (14->7 before this PR, 50->24 after this PR).

@commy2 commy2 added this to the 3.3 milestone Mar 17, 2017
@commy2 commy2 self-assigned this Mar 17, 2017
@jonpas
Copy link
Member

jonpas commented Mar 17, 2017

Additionally, ACRE is using setText on the local namespace for no apparent reason. I suggest that they stop doing that, since that cuts the FPS in half with 50k local namespaces (14->7 before this PR, 50->24 after this PR).

Going to be in ACRE 2.4.1.

@PabstMirror
Copy link
Contributor

Would createSimpleObject work?

@commy2
Copy link
Contributor Author

commy2 commented Mar 17, 2017

80 -> 77, so yeah, it helps a lot. Not usable for local namespaces though, since simple objects are always transferred over network.

Also only possible since this version:

Since Arma 3 v1.67 simple objects support setVariable and getVariable
https://community.bistudio.com/wiki/createSimpleObject

@commy2
Copy link
Contributor Author

commy2 commented Mar 17, 2017

Had to also adjust CBA_fnc_allNamespaces. createSimpleObject uses ASL, not AGL and does not support type filters. Since we cannot use a type filter anymore, I also changed the position to make it unlikely that another object is mistakenly reported by the function as namespace.

@commy2
Copy link
Contributor Author

commy2 commented Mar 18, 2017

typeOf still works, so we can use that to ensure it's a global namespace. Thanks @Dorbedo .

@commy2 commy2 merged commit f283bf0 into master Mar 18, 2017
@commy2 commy2 deleted the namespace-performance branch March 18, 2017 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants