Thanks for sharing ...

Jump to navigation Jump to search

Thanks for sharing ...

Hi mate. Nice one, i was just starting to write my own and now you share yours :). I will take it right away.

Wompi15:54, 5 July 2012

You are welcome:) Feel free to ask any questions or report any problems, if they will appear:) But do not forget to share any improvements:)

Jdev18:25, 5 July 2012
 

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:User talk:Jdev/Code/TimeProfiler/Thanks for sharing .../reply (2).

System.nanoTime() accuracy depends heavily on your hardware and OS.

MN20:59, 5 July 2012
 

Yes i guess you are right. But the difference is sometimes up to 100ms and that is clearly out of inaccuracy. I'm really not sure how some java programs can work without a proper time measure, but i'm sure it will work somehow and maybe i should learn a little more about this.

Wompi00:19, 6 July 2012
 

Just quick replay before going to bed: you,at least, miss garbage collector. Im not sure, but i think, that its stop all other threads.

Jdev19:32, 5 July 2012
 

Good point. I didn't know that the garbage collection is messing with the time measurement. I guess this makes max/total value a little obsolete. Anyway i'm very happy that you shared the code and it showed me that i'm running on 2ms turns, and i learned something too :). And of course if i find something to improve the functionality i will share it with pleasure.

Have a good night.

Wompi00:14, 6 July 2012
 

Ok, now full reply:)

At first, GC MAY blocks all threads, and for me (Win7, Java 6, default settings) it DOES it, because, for example in battles between Tomcat and Scarlet in late rounds game periodically freezes for seconds...

For robocode milliseconds is completly useless, but my experience shows, that nanoseconds is fairly usefull and i did find out with them some ways to decrease skipped turns amount.

Maybe there is a sense to add some kind of protection against invalid values, for example, discard values larger that 10 ms or larger than mean value more than 10 times

Jdev07:24, 6 July 2012
 

Just for clarification if i write ms it means μs :). I guess i'm simple to lazy to look for the μ on my keyboard especially if the metric is narrowed to the micro decadic. Because millisecond is indeed quite useless for robocode :). But it shows that i should be more precise in future discussions. The correct prefix, if you have no μ, would be "2us" which looks mighty strange to me.

Wompi10:51, 6 July 2012
 

Sorry, but yours message is not completely clear for me, because of my english skill...

Jdev10:55, 6 July 2012