MCPcopy
hub / github.com/parse-community/parse-server / runBenchmarks

Function runBenchmarks

benchmark/performance.js:835–918  ·  view source on GitHub ↗

* Run all benchmarks

()

Source from the content-addressed store, hash-verified

833 * Run all benchmarks
834 */
835async function runBenchmarks() {
836 core = await import('@actions/core');
837 logInfo('Starting Parse Server Performance Benchmarks...');
838
839 let server;
840
841 try {
842 // Initialize Parse Server
843 logInfo('Initializing Parse Server...');
844 server = await initializeParseServer();
845 httpServer = server;
846
847 // Wait for server to be ready
848 await new Promise(resolve => setTimeout(resolve, 2000));
849
850 const results = [];
851
852 // Define all benchmarks to run
853 const benchmarks = [
854 { name: 'Object.save (create)', fn: benchmarkObjectCreate },
855 { name: 'Object.save (update)', fn: benchmarkObjectUpdate },
856 { name: 'Object.saveAll (batch save)', fn: benchmarkBatchSave },
857 { name: 'Query.get (by objectId)', fn: benchmarkObjectRead },
858 { name: 'Query.find (simple query)', fn: benchmarkSimpleQuery },
859 { name: 'User.signUp', fn: benchmarkUserSignup },
860 { name: 'User.login', fn: benchmarkUserLogin },
861 { name: 'Query.include (parallel pointers)', fn: benchmarkQueryWithIncludeParallel },
862 { name: 'Query.include (nested pointers)', fn: benchmarkQueryWithIncludeNested },
863 { name: 'Query.find (large result, GC pressure)', fn: benchmarkLargeResultMemory },
864 { name: 'Query.find (concurrent, GC pressure)', fn: benchmarkConcurrentQueryMemory },
865 { name: 'Object.save (nested data, denylist scan)', fn: benchmarkObjectCreateNestedDenylist },
866 { name: 'Query $regex', fn: benchmarkQueryRegex },
867 { name: 'LiveQuery $regex', fn: benchmarkLiveQueryRegex },
868 ];
869
870 // Run each benchmark with database cleanup
871 const suiteStart = performance.now();
872 for (let idx = 0; idx < benchmarks.length; idx++) {
873 const benchmark = benchmarks[idx];
874 const label = `[${idx + 1}/${benchmarks.length}] ${benchmark.name}`;
875 logGroup(label);
876 try {
877 logInfo('Resetting database...');
878 resetParseServer();
879 await cleanupDatabase();
880 logInfo('Running benchmark...');
881 const benchStart = performance.now();
882 const result = await benchmark.fn(benchmark.name);
883 const benchDuration = ((performance.now() - benchStart) / 1000).toFixed(1);
884 results.push(result);
885 logInfo(`Result: ${result.value.toFixed(2)} ${result.unit} (${result.extra})`);
886 logInfo(`Duration: ${benchDuration}s`);
887 } finally {
888 logGroupEnd();
889 }
890 }
891 const suiteDuration = ((performance.now() - suiteStart) / 1000).toFixed(1);
892

Callers 1

performance.jsFile · 0.85

Calls 8

logInfoFunction · 0.85
initializeParseServerFunction · 0.85
logGroupFunction · 0.85
resetParseServerFunction · 0.85
cleanupDatabaseFunction · 0.85
logGroupEndFunction · 0.85
logErrorFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected