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

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

Open
sompylasar opened this issue Oct 28, 2017 · 4 comments

Comments

@sompylasar
Copy link

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

var material = this.materialize({
fragmentShader: source,
uniforms: uniforms
});
console.log(source, material);
return material;
},
rebuild: function () {
var self = this, passes = [], temp = [];

head.join("\n"), chunks.join("\n"), "\n",
premain.join("\n"), main.join("\n"),
alpha ? " gl_FragColor = color;" : " gl_FragColor = vec4(color.rgb, 1.0);", "}"
].join("\n");
var material = this.materialize({
fragmentShader: source,
uniforms: uniforms
});
console.log(source, material);
return material;
},
rebuild: function () {
var self = this, passes = [], temp = [];
this.passes.forEach(function(pass){
if (pass.dispose) pass.dispose();
});
this.data.forEach(function (k) {
if(!k){

@wizgrav
Copy link
Owner

wizgrav commented Nov 3, 2017

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

@sompylasar
Copy link
Author

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
Copy link
Author

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.

@wizgrav
Copy link
Owner

wizgrav commented Nov 3, 2017

Ok, can you submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants