Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4468023
event_loop.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
753 B
Referenced Files
None
Subscribers
None
event_loop.js
View Options
const
DURATION
=
5
_000
;
const
origin
=
performance
.
now
();
let
count
=
0
;
function
iter
()
{
count
++
;
if
(
performance
.
now
()
-
origin
<
DURATION
)
setImmediate
(
iter
);
}
iter
();
process
.
once
(
'beforeExit'
,
()
=>
{
const
elapsed
=
performance
.
now
()
-
origin
;
const
rate
=
count
/
(
elapsed
/
1000
);
let
formatted
;
if
(
rate
>=
1
_000_000
)
formatted
=
(
rate
/
1
_000_000
).
toFixed
(
2
)
+
'M'
;
else
if
(
rate
>=
1
_000
)
formatted
=
(
rate
/
1
_000
).
toFixed
(
1
)
+
'K'
;
else
formatted
=
String
(
Math
.
round
(
rate
));
console
.
log
(
`\x1b[1;36m
${
formatted
}
event loop iterations/sec\x1b[0m \x1b[2m(
${
count
.
toLocaleString
()
}
in
${
(
elapsed
/
1000
).
toFixed
(
1
)
}
s)\x1b[0m`
);
if
(
typeof
globalThis
.
Ant
!==
'undefined'
)
console
.
log
(
'ant version:'
,
Ant
.
version
);
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, May 2, 7:33 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
539593
Default Alt Text
event_loop.js (753 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment