performance - how to check ram consumption javascript - Stack Overflow

admin2025-04-03  1

I need to improve the performance of a script done in Javascript, and I can check the RAM consumption script said.

for example like the PHP function get_memory_get_peak()

I need to improve the performance of a script done in Javascript, and I can check the RAM consumption script said.

for example like the PHP function get_memory_get_peak()

Share asked Oct 22, 2011 at 17:14 rkmaxrkmax 18.2k23 gold badges94 silver badges180 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 12

In Chrome, if you run with the --enable-memory-info flag, you can get the data from:

console.memory;

which contains:

jsHeapSizeLimit
totalJSHeapSize
usedJSHeapSize

This data can also be fetched from a memory heap snapshot by pressing F12, but this is not programmatically.

The Chrome developer tools include a heap profiler: http://code.google./chrome/devtools/docs/heap-profiling.html

You cannot read memory data using JavaScript code. A method to see the memory consumption is by inspecting the process.

Chrome has a built-in statistics screen, which can be summoned using Shift + Esc. This screen shows various information about each tab, including memory consumption.

You could format the PHP code with CSS & JS, but that's about it. Use the PHP Function, and HTML can't do that, it's just a markup language.

    <?php
    print(get_memory_get_peak());
    ?>

Try using the Task Manager, go to processes, and check the usage stats!

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1743687819a215471.html

最新回复(0)