-
Notifications
You must be signed in to change notification settings - Fork 6
Speed test
Kiran Reddy edited this page Nov 19, 2020
·
5 revisions
Import-Module PSLiteDB
$dbPath = "C:\temp\LiteDB\speedtest.db"
New-LiteDBDatabase -Path $dbPath -Verbose
Open-LiteDBConnection -Database $dbPath
New-LiteDBCollection -Collection P1
Get-LiteDBCollectionName
$time_bsonconversion = [System.Diagnostics.Stopwatch]::new()
$time_bsonconversion.Start()
$array = 1..30000 | ForEach-Object {
[PSCustomObject]@{
FirstName = "user-{0}" -f $_
LastName = "lastname-{0}" -f $_
Age = $_
Date = Get-Date
Long = (Get-Date).Ticks
}
} | ConvertTo-LiteDBBSON -As Array
$time_bsonconversion.Stop()
$time_bsonInsert = [System.Diagnostics.Stopwatch]::new()
$time_bsonInsert.Start()
Add-LiteDBDocument -Collection P1 -BsonDocumentArray $array -BatchSize 10000 -BulkInsert
$time_bsonInsert.Stop()
$time_bsonconversion
$time_bsonInsert