31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
async function testOldEndpoint() {
|
|
try {
|
|
console.log('Testing old endpoint http://localhost:4000/api/vault');
|
|
const start = performance.now();
|
|
const response = await fetch('http://localhost:4000/api/vault');
|
|
const data = await response.json();
|
|
const duration = performance.now() - start;
|
|
|
|
console.log('Response status:', response.status);
|
|
console.log('Duration:', duration.toFixed(2), 'ms');
|
|
console.log('Notes count:', data.notes?.length || 0);
|
|
|
|
const payloadSize = JSON.stringify(data).length;
|
|
const payloadSizeMB = (payloadSize / 1024 / 1024).toFixed(2);
|
|
const payloadSizeKB = (payloadSize / 1024).toFixed(0);
|
|
|
|
console.log('Payload size:', payloadSizeMB, 'MB (', payloadSizeKB, 'KB)');
|
|
console.log('Average per note:', (payloadSize / (data.notes?.length || 1)).toFixed(0), 'bytes');
|
|
|
|
if (data.notes && data.notes.length > 0) {
|
|
console.log('Sample note size:', JSON.stringify(data.notes[0]).length, 'bytes');
|
|
}
|
|
} catch (error) {
|
|
console.error('Error:', error.message);
|
|
}
|
|
}
|
|
|
|
testOldEndpoint();
|