Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>does it slow down your program at all (for lots of print statements) </code></pre> <p>yes you can manually test by using <code>System.nanoTime();</code></p> <p><strong>Note</strong> I have seen people use <code>System.currentTimeMillis()</code> to check the execution time but this is not the right way . Use <code>System.nanoTime();</code> to check execution time.</p> <blockquote> <p><code>System.currentTimeMillis()</code> is implemented using the <code>GetSystemTimeAsFileTime</code> method, which essentially just reads the low resolution time-of-day value that Windows maintains. Reading this global variable is naturally very quick - around 6 cycles according to reported information. This time-of-day value is updated at a constant rate regardless of how the timer interrupt has been programmed - depending on the platform this will either be 10ms or 15ms (this value seems tied to the default interrupt period).</p> <p><code>System.nanoTime()</code> is implemented using the <code>QueryPerformanceCounter</code> / <code>QueryPerformanceFrequency</code> API (if available, else it returns <code>currentTimeMillis*10^6</code>). <code>QueryPerformanceCounter</code>(QPC) is implemented in different ways depending on the hardware it's running on. Typically it will use either the programmable-interval-timer (PIT), or the ACPI power management timer (PMT), or the CPU-level timestamp-counter (TSC). Accessing the PIT/PMT requires execution of slow I/O port instructions and as a result the execution time for QPC is in the order of microseconds. In contrast reading the TSC is on the order of 100 clock cycles (to read the TSC from the chip and convert it to a time value based on the operating frequency). You can tell if your system uses the ACPI PMT by checking if QueryPerformanceFrequency returns the signature value of 3,579,545 (ie 3.57MHz). If you see a value around 1.19Mhz then your system is using the old 8245 PIT chip. Otherwise you should see a value approximately that of your CPU frequency (modulo any speed throttling or power-management that might be in effect.)</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload