Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance testing #379

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Tests/XMTPTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -837,4 +837,37 @@ class GroupTests: XCTestCase {

XCTAssertEqual(preparedMessageId, messages.first!.id)
}

func createGroups(client: Client, peer: Client, numGroups: Int) async throws {
for i in 0..<numGroups {
try await client.conversations.newGroup(with: [peer.address])
}
}

func testGroupListPerformance() async throws {
let fixtures = try await localFixtures()

try await createGroups(client: fixtures.aliceClient, peer: fixtures.bobClient, numGroups: 50)

var start = Date()
var groups = try await fixtures.aliceClient.conversations.groups()
var end = Date()
print("Alix loaded \(groups.count) groups in \(end.timeIntervalSince(start) * 1000)ms")

start = Date()
try await fixtures.aliceClient.conversations.sync()
end = Date()
print("Alix synced \(groups.count) groups in \(end.timeIntervalSince(start) * 1000)ms")

start = Date()
try await fixtures.bobClient.conversations.sync()
end = Date()
print("Bo synced \(groups.count) groups in \(end.timeIntervalSince(start) * 1000)ms")

start = Date()
groups = try await fixtures.bobClient.conversations.groups()
end = Date()
print("Bo loaded \(groups.count) groups in \(end.timeIntervalSince(start) * 1000)ms")

}
}
Loading