Curious Question, just how much power Console.log use???

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I have a curious question here, see this code

Code:
Window_BattleStatus.prototype.drawActorAtb =  function(actor, x, y, width) {
    width = width || 186;
    var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();
    this.drawGauge(x, y, width, actor.atbRate(), color1, color2);
    this.changeTextColor(this.systemColor());
    this.drawText("ATB", x, y, 44);
  };
So this runs, every frame without really having any visible slowdown,

Now if I do this

Code:
Window_BattleStatus.prototype.drawActorAtb =  function(actor, x, y, width) {
    Console.log("Text here");
    width = width || 186;
    var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();
    this.drawGauge(x, y, width, actor.atbRate(), color1, color2);
    this.changeTextColor(this.systemColor());
    this.drawText("ATB", x, y, 44);
  };
I simply added a console.log call in there and now it slowdowns to a super slow mode like it takes 3+ seconds before my cursor moves when I press an arrow key.

So I was just curious if console.log really does use that much power
 

xilefian

Veteran
Veteran
Joined
Nov 26, 2014
Messages
121
Reaction score
194
First Language
English
Primarily Uses
Assuming by "power" you mean "processing time", as opposed to "power consumption".

It is likely that console.log is a thread-blocking operation, so the execution will pause during the time it takes to parse the object(s) sent with the console.log and also the time it takes to output to the console and update the UI to display the contents. Standard IO functions on Windows are like this, so it wouldn't surprise me at all if the NW.js implementation is blocking.

Keep in mind Javascript implementations heavily depend on the browser and sometimes the platform OS, so for some people console.log may not have a performance impact at all.

Generally, you don't want to be logging something every frame; that will fill up your log and prevent you from spotting messages that are important. Only output every frame during development if you want to test out something, remove it once you've finished the test.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I just tried to add it out of curiosity and just to make sure that it actually runs.. I just became curious of the behavior as I never noticed a visible slowdown when using the print to console command while testing my scripts on Ace.

Don't worry, I always remove almost all of my test console print outs after I'm done testing things out. :3
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
I don't have any performance impact on console.log () and my machine is a potato.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I normally don't have it on console.log that run only once or after a few frames, this one runs every frame or actually 4 times per frame I think since it's once per frame per actor and I currently have 4 actors.. XD
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
If you overload console.log, no wonder you have performance losses though. This happens even with normal parallel events, running four parallels wih no wait command completely kills the machine.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yeah seems like it, maybe JS also runs a bit slower on my comp as something like that never caused my Ace to lag (I use them a lot for debugging and most of the time that's what I'm doing)..

Anyway I guess my curious question is answered now :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Javascript has been known as not being the fastest one to perform orders, which may contribute to it too. As well as it being a not very good language for multitasking and even rmmv is not the best multitasking engine ever... Nothing beats RM2k3 in multitasking :D
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
the command and the debug console is very very heavy.
It used only during the test and debug and removed from the publication.
if you want see how it heavy consumption this console are, you can take a look at
package.json.
add the line
PHP:
"chromium-args" : "--show-fps-counter ",
to the package.json in your rmmv software dir.
the tool run at 20 fps and you will see ticks of the console.
Also use console.log(), in a update process and you will drop to 4,5 fps.
It will also impact game , sometime drop to 58,59 fps
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top