aframe-effects icon indicating copy to clipboard operation
aframe-effects copied to clipboard

Unconditional debug output `console.log(source, material);` may affect performance

Open sompylasar opened this issue 6 years ago • 4 comments

The debug output should only run in some debug mode (you could use the debug package for that).

https://github.com/wizgrav/aframe-effects/blob/776d69fb4c3757b7bb544146cea164bd008b514e/systems/effects.js#L260-L270

https://github.com/wizgrav/aframe-effects/blob/c4f9cdb48cc95d2af2bc3ff4bf63edff472d3697/dist/aframe-effects.js#L496-L516

sompylasar avatar Oct 28 '17 08:10 sompylasar

You're right, I think an approach could be to check if the debug component is set on the a-scene element. Thanks for noticing

wizgrav avatar Nov 03 '17 15:11 wizgrav

an approach could be to check if the debug component is set on the a-scene element.

Querying the browser DOM is slow compared to querying a JS variable. Especially repeatedly.

sompylasar avatar Nov 03 '17 19:11 sompylasar

But of course both approached should be benchmarked to find the most performant.

Using the de-facto standard debug module lets the users to remove the debug calls in production builds. Using the a-scene debug component may require extra dancing to strip that out.

sompylasar avatar Nov 03 '17 19:11 sompylasar

Ok, can you submit a PR?

wizgrav avatar Nov 03 '17 19:11 wizgrav