Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: sdk/lib/core/stopwatch.dart

Issue 154263010: Initialize the frequeny once and use it, avoid calling a native method every (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/stopwatch.dart
===================================================================
--- sdk/lib/core/stopwatch.dart (revision 32658)
+++ sdk/lib/core/stopwatch.dart (working copy)
@@ -8,6 +8,11 @@
* A simple stopwatch interface to measure elapsed time.
*/
class Stopwatch {
+ /**
+ * Frequency of the elapsed counter in Hz.
+ */
+ final int frequency = _frequency();
+
// The _start and _stop fields capture the time when [start] and [stop]
// are called respectively.
// If _start is null, then the [Stopwatch] has not been started yet.
@@ -24,7 +29,7 @@
*
* Stopwatch stopwatch = new Stopwatch()..start();
*/
- Stopwatch() : _start = null, _stop = null {}
+ Stopwatch();
/**
* Starts the [Stopwatch].
@@ -116,10 +121,6 @@
return (elapsedTicks * 1000) ~/ frequency;
}
- /**
- * Returns the frequency of the elapsed counter in Hz.
- */
- int get frequency => _frequency();
/**
* Returns wether the [StopWatch] is currently running.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698