FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack-javascript/benchmark/string.ts at main · msgpack/msgpack-javascript · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
msgpack
/
msgpack-javascript
Public
Notifications
You must be signed in to change notification settings
Fork
180
Star
1.6k
Code
Issues
18
Pull requests
6
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack-javascript
/
benchmark
/
string.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (40 loc) · 1.06 KB
Breadcrumbs
msgpack-javascript
/
benchmark
/
string.ts
Copy path
File metadata and controls
50 lines (40 loc) · 1.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* eslint-disable no-console */
import
{
encode
,
decode
}
from
"../src/index.ts"
;
const
ascii
=
"A"
.
repeat
(
40000
)
;
const
emoji
=
"🌏"
.
repeat
(
20000
)
;
{
// warm up ascii
const
data
=
ascii
;
const
encoded
=
encode
(
data
)
;
decode
(
encoded
)
;
console
.
log
(
`encode / decode ascii data.length=
${
data
.
length
}
encoded.byteLength=
${
encoded
.
byteLength
}
`
)
;
// run
console
.
time
(
"encode ascii"
)
;
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
encode
(
data
)
;
}
console
.
timeEnd
(
"encode ascii"
)
;
console
.
time
(
"decode ascii"
)
;
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
decode
(
encoded
)
;
}
console
.
timeEnd
(
"decode ascii"
)
;
}
{
// warm up emoji
const
data
=
emoji
;
const
encoded
=
encode
(
data
)
;
decode
(
encoded
)
;
console
.
log
(
`encode / decode emoji data.length=
${
data
.
length
}
encoded.byteLength=
${
encoded
.
byteLength
}
`
)
;
// run
console
.
time
(
"encode emoji"
)
;
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
encode
(
data
)
;
}
console
.
timeEnd
(
"encode emoji"
)
;
console
.
time
(
"decode emoji"
)
;
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
decode
(
encoded
)
;
}
console
.
timeEnd
(
"decode emoji"
)
;
}
Back
|
FazBrowse Home
|
New Git URL