trace(object) is extremely slow?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
SmartfoxEnjoyer
Posts: 93
Joined: 13 Dec 2023, 20:39

trace(object) is extremely slow?

Post by SmartfoxEnjoyer »

After some testing I found that my physics simulation was taking about 120ms each step, after removing the trace() methods, it went down to about 1ms :shock:

I had about 12 of them in the whole physics step from start to finish for debugging reasons. Also they were tracing things like array.size() or list.get(0).myParameter, etc.

If i use trace("start") as an example, just a primitive String it only takes 1ms or less, but trace(object) seems to take very long. Can you please confirm if this is true?

Thanks.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: trace(object) is extremely slow?

Post by Lapo »

Maybe it depends on the object itself.
When you pass an object the .toString() method of that obj is invoked. I suspect that's where most of the time is spent. The trace() method uses log4j to log data, which is not that expensive in terms of cpu time.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply