-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as Test from './test.js' | ||
import * as Result from '../src/result.js' | ||
import { randomCAR } from './helpers/random.js' | ||
|
||
/** | ||
* @type {Test.Suite} | ||
*/ | ||
export const testMem = { | ||
'test usage': async ( | ||
assert, | ||
{ client, mail, connect, grantAccess, plansStorage } | ||
) => { | ||
const space = await client.createSpace('test') | ||
|
||
const email = '[email protected]' | ||
const login = client.login(email) | ||
const message = await mail.take() | ||
assert.deepEqual(message.to, email) | ||
await grantAccess(message) | ||
const account = await login | ||
|
||
Result.try(await account.provision(space.did())) | ||
await space.save() | ||
|
||
const car = await randomCAR(50_000_000) | ||
const before = process.memoryUsage() | ||
console.log(before) | ||
|
||
// @ts-expect-error | ||
const link = await client.uploadCAR(car, { pieceHasher: null }) | ||
|
||
const after = process.memoryUsage() | ||
|
||
console.log({ | ||
rss: after.rss - before.rss, | ||
heapTotal: after.heapTotal - before.heapTotal, | ||
heapUsed: after.heapUsed - before.heapUsed, | ||
external: after.external - before.external, | ||
arrayBuffers: after.arrayBuffers - before.arrayBuffers, | ||
}) | ||
}, | ||
} | ||
|
||
Test.test({ MemoryUse: testMem }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters