• [HTML5/Javascript] Am I properly recording operation per second?
    17 replies, posted
So, I am trying to get into the whole canvas craze and want to record how many operations I can achieve per second. It seems to be really bad.. 170 with my Athlon x2 6000+ and Chrome, 250 in Firefox. Am I doing something wrong? What does the typical Operation per second or Frame per second code look like in Javascript? [CODE]// GetElapsedMilliseconds = Function() { var time = new Date(); return time.getMilliseconds(); } if (GetElapsedMilliseconds() - oldTime >=1000) { OPS = count; count = 0; oldTime = GetElapsedMilliseconds(); } ++count; loop = setTimeout('Main()', DELAY);[/CODE]
Just use [URL="https://github.com/mrdoob/stats.js"]stats.js[/URL].
Using code developed by someone else doesn't really help me learn anything, though.
Because it's not as if you could actually look at the source. That would be insane! What a mad man I am for even considering such a feat.
whoa jelly slow down what happened to that whole "don't be a dick" thing
[QUOTE=Jelly;35589407]Because it's not as if you could actually look at the source. That would be insane! What a mad man I am for even considering such a feat.[/QUOTE] Have you looked at the source? It neither explains how you properly record frame rate nor are there any comments to explain the reason behind his madness...
[QUOTE=Kopimi;35589496]whoa jelly slow down what happened to that whole "don't be a dick" thing[/QUOTE] He's on his period
:tinfoil:
[QUOTE=false prophet;35589889]Have you looked at the source? It neither explains how you properly record frame rate nor are there any comments to explain the reason behind his madness...[/QUOTE] Yes, and it explains it rather well. Code that self explanatory never needs comments, I almost never comment when coding.
[url]https://github.com/mrdoob/stats.js/blob/master/src/Stats.js[/url] That doesn't really need comments
[QUOTE=KmartSqrl;35601951][url]https://github.com/mrdoob/stats.js/blob/master/src/Stats.js[/url] That doesn't really need comments[/QUOTE] Hi, thanks for absolutely not answering my original question at all. Thank you all so much.
You asked what the typical fps code looked like, we linked you to some code. How is that not answering your question?
[QUOTE=false prophet;35603997]Hi, thanks for absolutely not answering my original question at all. Thank you all so much.[/QUOTE] What's wrong with linking you to optimized, stable and tested code showing you how to do exactly what you asked for?
Check out the update function in stats.js, most of the other code is just GUI. Also a tip: Dont ever pass strings to setInterval / setTimeout, use variables instead: setTimeout(Main,DELAY);
[QUOTE=false prophet;35603997]Hi, thanks for absolutely not answering my original question at all. Thank you all so much.[/QUOTE] All the variables are named well enough. If you don't have the desire to figure out how it works by reading the code then just use it. If you're trying to learn, then look at it and learn. If you want to learn how to develop you need to learn how to read other people's code.
[QUOTE=Jelly;35604256]You asked what the typical fps code looked like, we linked you to some code. How is that not answering your question?[/QUOTE] You can't actually expect [I]effort[/I] on his part. What are you? Some sort of [B]nazi[/B]? I want hand-holding, and I want it now!
[QUOTE=StinkyJoe;35608768]You can't actually expect [I]effort[/I] on his part. What are you? Some sort of [B]nazi[/B]? I want hand-holding, and I want it now![/QUOTE] Effort and hand holding... wat? I supplied my own written code and asked if it was done improperly because of the low result. Then was told to "just use" someone else's work. "just use"ing someone else's code doesn't help at all to understand if an issue is right or wrong. For all I know their code could have been wrong too. Two wrong's and such. But whatever, this thread needs to be closed because the only thing being put here is retarded troll comments. Aside from KmartSqrl and reeferdk.
[QUOTE=false prophet;35615144]Effort and hand holding... wat? I supplied my own written code and asked if it was done improperly because of the low result. Then was told to "just use" someone else's work. "just use"ing someone else's code doesn't help at all to understand if an issue is right or wrong. For all I know their code could have been wrong too. Two wrong's and such. But whatever, this thread needs to be closed because the only thing being put here is retarded troll comments. Aside from KmartSqrl and reeferdk.[/QUOTE] Yes, thank you, I will not attempt to help you in the future by linking you to a proper way of getting the current frame rate in JavaScript that is used in many WebGL/three.js projects. Thereby providing code that is very reliable and widely used even though you'll only be using it for baby stuff compared to what others use it for. You could of just asked if you didn't understand a piece of code and I'm sure me or another user would have provided an in depth, line-by-line explanation into how it worked. I don't expect many people will help you if you call their attempts at trying to "retarded troll comments. You know, we aren't getting paid to help you and some courtesy would be the respectable and polite thing to do.
Sorry, you need to Log In to post a reply to this thread.