evancz / first-person-elm

First-person navigation in a simple 3D world, written in Elm
BSD 3-Clause "New" or "Revised" License
85 stars 11 forks source link

FPS / performance analysis #4

Open TTimo opened 10 years ago

TTimo commented 10 years ago

This is really cool from a technology perspective, however the performance is pretty abysmal.

I tried Chrome and FireFox, OSX and Linux .. albeit very briefly .. it's nowhere near the fps and control response as a some simple OpenGL in a tiny native app. Or even Unity web player.

I know there are a lot of reasons for this, and that's a typical problem with this sort of tech stack, everyone passes the hot potato around .. to JS, to WebGL, to the browser etc.

It would be very interesting if someone with the technical know-how and time was able to profile this and point out where things are stalling, buffered, and generally where time is spent.

evancz commented 10 years ago

@johnpmayer can say for sure, but the WebGL bindings are very new and I don't think we've done any formal benchmarking. The API is designed to be good about limiting traffic to gpu (which I suspect is the issue if we are responsible for this) and I can easily imagine that the implementation got some caching wrong or something.

In any case, performance has not been a major focus so far because we had other design challenges, but that means there's quite a lot of easy stuff we can do. This will be one of the focuses this summer, so I very very much support taking a data driven approach and profiling as much as possible.

johnpmayer commented 10 years ago

Yeah... I need to learn how to properly profile JavaScript. I have confirmed that all of the caching is working correctly. On May 30, 2014 1:09 PM, "Evan Czaplicki" notifications@github.com wrote:

@johnpmayer https://github.com/johnpmayer can say for sure, but the WebGL bindings are very new and I don't think we've done any formal benchmarking. The API is designed to be good about limiting traffic to gpu (which I suspect is the issue) but I can easily imagine that the implementation got some caching wrong or something.

In any case, performance has not been a major focus so far because we had other design challenges, but that means there's quite a lot of easy stuff we can do. This will be one of the focuses this summer, so I very very much support taking a data driven approach and profiling as much as possible.

— Reply to this email directly or view it on GitHub https://github.com/evancz/first-person-elm/issues/4#issuecomment-44674975 .

johnpmayer commented 10 years ago

Looks like a lot of time is spent recalculating the height of the overlaid plaintext On May 30, 2014 2:21 PM, "John Mayer" john.p.mayer.jr@gmail.com wrote:

Yeah... I need to learn how to properly profile JavaScript. I have confirmed that all of the caching is working correctly. On May 30, 2014 1:09 PM, "Evan Czaplicki" notifications@github.com wrote:

@johnpmayer https://github.com/johnpmayer can say for sure, but the WebGL bindings are very new and I don't think we've done any formal benchmarking. The API is designed to be good about limiting traffic to gpu (which I suspect is the issue) but I can easily imagine that the implementation got some caching wrong or something.

In any case, performance has not been a major focus so far because we had other design challenges, but that means there's quite a lot of easy stuff we can do. This will be one of the focuses this summer, so I very very much support taking a data driven approach and profiling as much as possible.

— Reply to this email directly or view it on GitHub https://github.com/evancz/first-person-elm/issues/4#issuecomment-44674975 .

evancz commented 10 years ago

That makes sense some sense. I wonder if lifting it out or getting rid of it makes a big difference.

I think let-floating can help so constant things are not computed unnecessarily. I've been thinking about some tricks to avoid computing dimensions of text. I mentioned one in #637 that'd let you avoid recomputing big chunks of elements, and this would be a fine candidate for that.

evancz commented 10 years ago

I made it so that the text never gets re-rendered. Does that make a difference for you guys?