UserArray
UserArray.At(i) in Go
Pseudata’s pseudo-arrays provide constant-time access to any element, regardless of its position in the sequence. Unlike traditional arrays that must allocate memory or sequential generators that must iterate through all previous elements, pseudo-arrays compute each element independently in time.
This page demonstrates real-world performance characteristics across different array types and access patterns.
The following benchmarks measure the time to access individual elements at various positions, from the first element to the trillionth (). All tests were performed on an average laptop.
UserArray
UserArray.At(i) in Go
AddressArray
AddressArray.At(i) in Go
The tables above are representative examples demonstrating access time characteristics—Pseudata includes pseudo-arrays for many more entity types beyond User and Address.
As demonstrated above, access time remains practically constant—whether retrieving the 1st element or the trillionth (). This validates true behavior: index position has negligible impact on performance, enabling instant access to any element in a trillion-element dataset.
The column shows the seeking time—the overhead of advancing the PCG32 generator to the target index. This seeking operation is technically due to the generator’s advance() method, which uses binary exponentiation to jump to any position.
Total access time = Seeking time () + Generation time
The seeking factor is so small compared to the constant generation time that practical access time is effectively . Even at index (over 1 trillion), seeking adds only a negligible amount for real-world use cases.
Put this in perspective: While Pseudata’s seeking overhead is measured in microseconds (millionths of a second), traditional sequential generators would take seconds or tens of seconds to iterate through millions of records—a difference of six orders of magnitude.
The slight variations in access time are due to:
UserArray generates more fields than AddressArrayAll benchmarks use Go’s standard testing.B benchmark framework with the following settings:
To understand the practical impact of access, consider how Pseudata compares to traditional data generation approaches.
Traditional faker libraries must iterate through all previous elements:
# To access element 1,000,000 with traditional fakerfaker.seed(42)for i in range(1_000_000): # Must iterate O(n) user = faker.person()With Pseudata:
# Direct access - O(1)users = UserArray(42)user = users.at(1_000_000) # Instant O(1) accessPre-allocated arrays require memory proportional to size:
# Traditional array for 1 million usersusers = [generate_user(i) for i in range(1_000_000)] # High memory usageWith Pseudata:
# Pseudo-array for 1 trillion usersusers = UserArray(42)user = users.at(1_000_000_000_000) # No memory overhead© 2025 Pseudata Project. Open Source under Apache License 2.0. · RSS Feed