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

Misc Questions #29

Closed
gregmax17 opened this issue Oct 15, 2015 · 1 comment
Closed

Misc Questions #29

gregmax17 opened this issue Oct 15, 2015 · 1 comment

Comments

@gregmax17
Copy link

Hello, just found this engine and it looks amazing. I have several questions about the framework, and I appreciate any feedback.

  • In some areas of the code, I noticed it creates a function within a function (like the scene.modelView creates a function fnProcessEntities). Isn't this poor performance? Should this function be outside of the modelView method?
  • In the same scene.modelView method, I notice at the beginning it uses some of the gl-matrix methods vec4.fromValues, which basically creates a new object every time this called? Couldn't these be some property which could be updated instead?
  • Hopefully this last one Q isn't a tl;dr... In my game I'm creating a large plane (1024x1204) with 12 vertical and horizontal segments and a texture. The way I have the camera set up looks at this plane from an isometric view. The plane's texture is bit jaggy (kind of expected), but I don't want to simply increase the segment count. The reason I don't want to is because I see in the scene.modelView method that it loops through each vertex and does some matrix 4 calculations. A very heavy process. Do you know if this can be optimized?

Thanks in advance for your time and answers :)

@kevinroast
Copy link
Owner

Hello and thanks for your questions,

Phoria.js has been extensively profiled (as I perform code tuning as part of my day job often, in Java/JS with cloud-scale applications).

None of the methods you mention caused a perform hit during real-world usage. Why? Because >90% of all CPU time for phoria.js process is taken up by rendering - and it's very hard to improve that - basically the canvas methods to render the various objects are the bottleneck. Modern JS code is extremely fast and there are many optimizations in the VMs that automatically apply.

Try profiling it yourself in Chrome inspector for instance with a heavy scene. You will see rendering is most of the problem, also sorting of large scenes can come up. If you see something when profiling that is an issue then of course raise it - but I've found from experience that second-guessing performance problems without profiling is almost guaranteed to be wrong!

Unfortunately there is no easy solution for the jaggy texture problem without increasing the segment count. The rendering in phoria.js is very primitive compared to webgl.

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