How to debug/find performance problems?

How do I find/locate performance problems? I have something weird in my script were resizing the window causes performance problems. The resize code itself is not the problem. Is there an easy way in the new debugger to locate performance bottlenecks like in Visual Studio? Some kind of profiler?

I bet there is a loop somewhere that has problems breaking out. But which one...
Chrome does come with a JS profiler that you can run to see what function calls take up the most time per frame, but since it shows you information on every frame, it's quite a lot to sort through. But, it should how you easily find which calls are longer than they should be.
Thanks.

And without a browser? Because my script isn't even compatible with browsers it seems.
Thanks.

And without a browser? Because my script isn't even compatible with browsers it seems.
How can that be?

When you create a project and save that, you'll get an index.html file.

Just start it with chrome and the game starts with all activated plugins in your browser.
Because Javascript is not the same for a desktop PC as it is for browsers or mobile phones. It's not 100% crossplatform, maybe 98% but not 100%. I found that out the hard way. Like this code:

function fileExists(filename){ var fullPath = this.FolderPath() + filename; var fs = require('fs'); // <<< browsers should crash here. At least FireFox does for me. Doesn't know the require-command. return fs.existsSync(fullPath);}Although I think FireFox does know the require command. It probably doesn't know or blocks the 'fs' filesystem package.
Because Javascript is not the same for a desktop PC as it is for browsers or mobile phones. It's not 100% crossplatform, maybe 98% but not 100%. I found that out the hard way. Like this code:

function fileExists(filename){ var fullPath = this.FolderPath() + filename; var fs = require('fs'); // <<< browsers should crash here. At least FireFox does for me. Doesn't know the require-command. return fs.existsSync(fullPath);}Although I think FireFox does know the require command. It probably doesn't know or blocks the 'fs' filesystem package.
As far as I could find out, Firefox doesn't support the filesystem API like chrome does.

There is a API which does something like this, but in a sandbox, not on the actual disk.

https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Introduction

I also did find a site which states that there will be an experimental low-level API that is said to provide access with the NodeJS API.

But that isn't done yet.
Thanks.

And without a browser? Because my script isn't even compatible with browsers it seems.

How can that be?

When you create a project and save that, you'll get an index.html file.

Just start it with chrome and the game starts with all activated plugins in your browser.

Because Javascript is not the same for a desktop PC as it is for browsers or mobile phones. It's not 100% crossplatform, maybe 98% but not 100%. I found that out the hard way. Like this code:

function fileExists(filename){ var fullPath = this.FolderPath() + filename; var fs = require('fs'); // <<< browsers should crash here. At least FireFox does for me. Doesn't know the require-command. return fs.existsSync(fullPath);}Although I think FireFox does know the require command. It probably doesn't know or blocks the 'fs' filesystem package.

As far as I could find out, Firefox doesn't support the filesystem API like chrome does.

There is a API which does something like this, but in a sandbox, not on the actual disk.

https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Introduction

I also did find a site which states that there will be an experimental low-level API that is said to provide access with the NodeJS API.

But that isn't done yet.
The desktop client is a browser. However, it also has some added goodies. The games are run on NodeJS, which gives us access to a lot of system-functions, such as the filesystem. However, these are only available on the desktop client. But, the good news is, the desktop client uses NWJS to give us a web browser (Node itself isn't a browser, as I understand it). NWJS gives us Chrome 41, which is a rather recentish version of chrome. Because it's running chrome, we have access to Chrome's lovely debugging tools. Just press F8 to open them during a play test. And, since we're running off of chrome, these dev tools have Chrome's JS profiler, which is what you're looking for.

The 'require' function is provided to games by NodeJS, and is used to get a variable that can be used to interact with the features Node gives us. SilverDash is using Node's FileSystem API, and thus is loading in the variable using require('fs'). Since this is a Node feature, it won't work on web browsers or mobile devices. Only the desktop client that MV comes with.
If you take a look at the StorageManager, you'll see that it uses local web storage, when Node.js isn't available:

Code:
StorageManager.isLocalMode = function() {    return Utils.isNwjs();};
This can be used to determine the environment you are in. But if i want to save/load my own savefiles, i extend those 2 functions, instead:
Code:
StorageManager.localFilePath = function(savefileId) {    var name;    if (savefileId < 0) {        name = 'config.rpgsave';    } else if (savefileId === 0) {        name = 'global.rpgsave';    } else {        name = 'file%1.rpgsave'.format(savefileId);    }    return this.localFileDirectoryPath() + name;};StorageManager.webStorageKey = function(savefileId) {    if (savefileId < 0) {        return 'RPG Config';    } else if (savefileId === 0) {        return 'RPG Global';    } else {        return 'RPG File%1'.format(savefileId);    }};
and use StorageManager.save/.load/.exists with my own savefile id (a string instead of a number, prefixed with my name).

Original thread: https://forums.rpgmakerweb.com/threads/how-to-debug-find-performance-problems.51899/