Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7540256
test_minicoro_concurrent.cjs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
862 B
Referenced Files
None
Subscribers
None
test_minicoro_concurrent.cjs
View Options
// Test that multiple async functions run concurrently
async function delay(ms, name) {
const start = Date.now();
await new Promise(resolve => setTimeout(resolve, ms));
const elapsed = Date.now() - start;
console.log(`${name}: ${elapsed}ms`);
return elapsed;
}
console.log("Testing concurrent async/await with minicoro");
const globalStart = Date.now();
// Start both async functions - they should run concurrently
delay(100, "Task A (100ms)");
delay(50, "Task B (50ms)");
// Wait for both to complete
setTimeout(() => {
const total = Date.now() - globalStart;
console.log(`\nTotal time: ${total}ms`);
// If concurrent: ~105ms (max of the two)
// If sequential: ~155ms (sum of the two)
if (total < 130) {
console.log("✓ PASS: Tasks ran concurrently!");
} else {
console.log("✗ FAIL: Tasks ran sequentially");
}
}, 120);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 17, 1:37 PM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
523794
Default Alt Text
test_minicoro_concurrent.cjs (862 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment