[PS] Poor performance
- From: "Grzegorz Niemirowski" <grzegorz@xxxxxxxxxxxx>
- Date: Tue, 16 May 2006 19:49:37 +0200
I wanted to count number of semicolons in a text file. This file is quite large (498 238 bytes) but I expected PowerShell to parse in a few seconds. Instead of seconds I got minutes. I don't know whether .NET overhead is the cause or there is a bug in my implementation.
PS> $a=gc a.eml
PS> $b=0
PS> date
PS> $a | foreach { for($i=0;$i -lt $_.length;$i++) { if($_[$i] -eq ";") { $b++ } } } ; $b ;
PS> date
16 maja 2006 19:44:21
1442
16 maja 2006 19:48:26
--
Grzegorz Niemirowski, Poland, Europe
www.grzegorz.net
Uptime: 1 day, 4 hours, 22 minutes and 10 seconds
.
- Follow-Ups:
- Re: [PS] Poor performance
- From: Grzegorz Niemirowski
- Re: [PS] Poor performance
- From: Bruce Payette [MSFT]
- Re: [PS] Poor performance
- From: Jouko Kynsijärvi
- Re: [PS] Poor performance
- Prev by Date: Re: Powershell won't run!
- Next by Date: Re: [PS] ShellIDs
- Previous by thread: Re: How to pass arguments to external program
- Next by thread: Re: [PS] Poor performance
- Index(es):