-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Steps to reproduce
$messageids | ForEach-Object -Parallel {$mid = $_; $using:log |
? messageid -eq $mid |
Sort-Object ExactTimeStamp |
Select-Object -first 1} |
Export-Csv mtl_midunique.csv -Encoding utf8 -NoTypeInformation$log held ~70000 lines imported from a csv holding the export of get-messagetrackinglog, $messageids had ~60000 lines imported from a csv, holding unique messageids
"ExactTimeStamp" was build from the TimeStamp property, format 'yyyyMMddHHmmssfff'
Expected behavior
quicker iteration through the date than single threaded, steady memory usage
Actual behavior
memory usage of the process building up to several GBs, slowing down the iteration to much less than this single threaded code:
&{foreach ($mid in $messageids) {&{foreach ($entry in $log) {if ($entry.messageid -eq $mid) {$entry}}} |
Sort-Object ExactTimeStamp |
Select-Object -first 1}} |
Export-Csv mtl_midunique.csv -Encoding utf8 -NoTypeInformationEnvironment data
Name Value
PSVersion 7.0.0-rc.1
PSEdition Core
GitCommitId 7.0.0-rc.1
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0