alanhdu / hunt

Play Hunt (the terminal game) online at http://quiet-forest-3036.herokuapp.com/
1 stars 0 forks source link

Speed #17

Closed samm81 closed 10 years ago

samm81 commented 10 years ago

So I mentioned this earlier, but it runs pretty slowly for me. Part of this is probably because I'm inside of a VM, but then it won't run smoothly on slower computers. It's just text, for crying out loud. I tried to do it the spans way, because I figured that would speed it up, but it didn't. I did some research and I found this: http://andrew.hedges.name/experiments/innerhtml/

This is terrible, because it suggests the cost of setting innerHTML is 60 ms. That's about two frames, which would explain the lag. I think our whole approach might be flawed.

alanhdu commented 10 years ago

Hm...I'm not sure we have many alternatives. Other than displaying text, the only other option I can think of is rendering on a canvas.

Maybe we can try innerText or textContent instead? http://blog.stevenlevithan.com/archives/faster-than-innerhtml has a suggestion for speeding things up too.

Another thing we can try is making the arena a

tag or