Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7536332
test_gc_coro.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
test_gc_coro.js
View Options
// Simulate TUI-like behavior: async handler with lots of string allocations
function
stripAnsi
(
str
)
{
return
str
.
replace
(
/\x1b\[[0-9;]*m/g
,
''
);
}
function
pad
(
str
,
len
)
{
const
visible
=
stripAnsi
(
str
).
length
;
const
diff
=
len
-
visible
;
if
(
diff
<=
0
)
return
str
;
return
str
+
' '
.
repeat
(
diff
);
}
function
render
()
{
// Simulate TUI render - matches what tui.js does
const
width
=
120
;
const
height
=
40
;
const
lines
=
[];
// Clear buffer
for
(
let
y
=
0
;
y
<
height
;
y
++
)
{
lines
.
push
(
' '
.
repeat
(
width
));
}
// Draw styled content (like the TUI does)
for
(
let
y
=
0
;
y
<
height
;
y
++
)
{
let
text
=
`\x1b[38;5;196mRow
${
y
}
\x1b[0m: `
;
text
+=
`\x1b[38;5;82m
${
'█'
.
repeat
(
20
)
}
\x1b[0m`
;
text
+=
`\x1b[2m
${
'░'
.
repeat
(
20
)
}
\x1b[0m`
;
text
=
pad
(
text
,
width
);
lines
[
y
]
=
text
;
}
return
lines
.
join
(
'\n'
);
}
async
function
handleEvent
(
n
)
{
// Simulate multiple renders per event (like scrolling does)
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
render
();
}
}
let
count
=
0
;
const
interval
=
setInterval
(()
=>
{
count
++
;
handleEvent
(
count
);
const
s
=
Ant
.
stats
(),
a
=
s
.
alloc
,
M
=
1024
*
1024
;
const
total
=
(
s
.
pools
.
totalUsed
+
a
.
total
)
/
M
;
console
.
log
(
`tick
${
count
}
: pools
${
(
s
.
pools
.
totalUsed
/
M
).
toFixed
(
1
)
}
MB obj
${
(
a
.
objects
/
M
).
toFixed
(
1
)
}
MB shp
${
(
a
.
shapes
/
M
).
toFixed
(
1
)
}
MB arr
${
(
a
.
arrays
/
M
).
toFixed
(
1
)
}
MB refs
${
(
a
.
propRefs
/
M
).
toFixed
(
1
)
}
MB cls
${
(
a
.
closures
/
M
).
toFixed
(
1
)
}
MB uv
${
(
a
.
upvalues
/
M
).
toFixed
(
1
)
}
MB ov
${
(
a
.
overflow
/
M
).
toFixed
(
1
)
}
MB |
${
total
.
toFixed
(
1
)
}
MB rss
${
(
s
.
rss
/
M
).
toFixed
(
1
)
}
MB`
);
if
(
count
>=
500
)
{
clearInterval
(
interval
);
setTimeout
(()
=>
{
const
a
=
Ant
.
stats
();
console
.
log
(
`done: total
${
((
a
.
pools
.
totalUsed
+
a
.
alloc
.
total
)
/
1024
/
1024
).
toFixed
(
1
)
}
MB`
);
},
10
);
}
},
10
);
// 500 * 10ms = 5 seconds
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 17, 12:16 PM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
560595
Default Alt Text
test_gc_coro.js (1 KB)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment