Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2916306
performance.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
814 B
Referenced Files
None
Subscribers
None
performance.js
View Options
import
{
test
,
summary
}
from
'./helpers.js'
;
console
.
log
(
'Performance Tests\n'
);
test
(
'performance exists'
,
typeof
performance
,
'object'
);
test
(
'performance toStringTag'
,
Object
.
prototype
.
toString
.
call
(
performance
),
'[object Performance]'
);
const
t1
=
performance
.
now
();
test
(
'now returns number'
,
typeof
t1
,
'number'
);
test
(
'now returns positive'
,
t1
>=
0
,
true
);
let
sum
=
0
;
for
(
let
i
=
0
;
i
<
10000
;
i
++
)
sum
+=
i
;
const
t2
=
performance
.
now
();
test
(
'now advances'
,
t2
>=
t1
,
true
);
test
(
'timeOrigin exists'
,
typeof
performance
.
timeOrigin
,
'number'
);
test
(
'timeOrigin positive'
,
performance
.
timeOrigin
>
0
,
true
);
const
wallNow
=
Date
.
now
();
const
perfNowEpoch
=
performance
.
timeOrigin
+
performance
.
now
();
test
(
'timeOrigin aligns with now'
,
Math
.
abs
(
perfNowEpoch
-
wallNow
)
<
1000
,
true
);
summary
();
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Thu, Mar 26, 4:46 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
511795
Default Alt Text
performance.js (814 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment