* Main execution function
()
| 639 | * Main execution function |
| 640 | */ |
| 641 | async function main () { |
| 642 | console.log("🔥 Memory Usage Benchmarks for Tenso Framework"); |
| 643 | console.log("=".repeat(60)); |
| 644 | |
| 645 | if (!global.gc) { |
| 646 | console.log("⚠️ Note: Garbage collection not exposed. Run with --expose-gc for better results.\n"); |
| 647 | } |
| 648 | |
| 649 | try { |
| 650 | await testServerLifecycle(); |
| 651 | await testRequestProcessing(); |
| 652 | await testParserMemory(); |
| 653 | await testRendererMemory(); |
| 654 | await testRateLimitMemory(); |
| 655 | await testHypermediaMemory(); |
| 656 | await testMemoryLeaks(); |
| 657 | await testMemoryPressure(); |
| 658 | |
| 659 | console.log("\n✅ Memory benchmarks completed\n"); |
| 660 | console.log("💡 Tips for memory optimization:"); |
| 661 | console.log(" - Monitor for consistent memory growth patterns"); |
| 662 | console.log(" - Implement proper cleanup for expired rate limit entries"); |
| 663 | console.log(" - Consider object pooling for high-frequency operations"); |
| 664 | console.log(" - Use WeakMap/WeakSet where appropriate for caching"); |
| 665 | console.log(" - Profile with tools like --inspect or clinic.js for production\n"); |
| 666 | |
| 667 | } catch (error) { |
| 668 | console.error("❌ Memory benchmark failed:", error); |
| 669 | process.exit(1); |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | main(); |
no test coverage detected