What is equivalent console.log() for local hosting?

My program that I just finished contains a lot of console.log()'s. Since that doesn’t take up a lot of processing speed to do, it is better not to use HTML when doing bigger calculations.

After a while, repl.it seems to stop the program If I were to leave it on for a hour to do a really big number of calculations. I want to put it on my PC so I can run it as long as I like rather then being limited by a website.

Should I use Visual Code studio and use that console? If I wasn’t, then what console exists on a computer to send the information and how can I edit my console.log()'s too be compatible with it?

This looks like it is a Node application (let me know if I am wrong). If that is the case, then the console.log() should log to the console that you run the node application (such as the command line, Powershell, or bash terminal if you are on Linux). Visual Studio Code has a built-in terminal that you can run the node command from and the console should log to that.

1 Like

This is because you’re attempting to execute a DoS (Denial of Service) attack on the repl.it servers.

1 Like

Hold on, FBI is knocking at my door…

After a few tests using VS studio, I notice how the computer will just stop running the program after a while.

I put in a massive string that would have upwards of 9! combinations, yet the computer will do just fine but always stop at 35% at roughly 3 hours w/ 121,000 combinations. Every time.

I have 8 GB of Ram (DDR3).

You’re assuming that console.log-ing things has no overhead. Console log itself has overhead. Not much, but some. it’s a debugging tool for inspecting bits of functionality: you’re still executing expensive bits of your program in those log calls.

But regardless, running that program for that length of time is likely just going to leak bits of memory until everything falls over. You need to be careful of this – anywhere you’re creating objects, closures etc., that will almost definitely cause memory leaks over time. And your program isn’t designed to stop, you just keep building up stuff, and so it will just keep eating memory until it dies.

What you’re trying to do is absolutely crazy by the way. JS isn’t designed for constant, very very long running heavy computation. It is designed for scripting in browsers. Maybe something
that isn’t single threaded and doesn’t have to operate in a sandboxed environment? It’s doable in JS, but you need to design a system very carefully if you want it to run a single expensive computation for hours and hours on end.

1 Like