Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7539518
bench_bigint_toString.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
554 B
Referenced Files
None
Subscribers
None
bench_bigint_toString.js
View Options
const
now
=
()
=>
Date
.
now
();
function
bench
(
name
,
fn
)
{
const
start
=
now
();
fn
();
const
end
=
now
();
console
.
log
(
`
${
name
}
:
${
end
-
start
}
ms`
);
}
const
digits
=
'9'
.
repeat
(
2000
);
const
big
=
BigInt
(
digits
);
const
big2
=
big
*
big
+
123456789n
;
bench
(
'toString(10) x200'
,
()
=>
{
for
(
let
i
=
0
;
i
<
200
;
i
++
)
{
big2
.
toString
(
10
);
}
});
bench
(
'toString(16) x200'
,
()
=>
{
for
(
let
i
=
0
;
i
<
200
;
i
++
)
{
big2
.
toString
(
16
);
}
});
bench
(
'toString(2) x40'
,
()
=>
{
for
(
let
i
=
0
;
i
<
40
;
i
++
)
{
big2
.
toString
(
2
);
}
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 17, 1:24 PM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
518672
Default Alt Text
bench_bigint_toString.js (554 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment