View Single Post
Old 08-30-2008   #5 (permalink)
Hal Rottenberg
Guest


 
 

Re: pipe to non-powershell process

bsdz wrote:
Quote:

> Thanks for your suggestion. Unfortunately, I cannot use it since it
> invokes a new instance of Perl on each and every line piped through by
> powershell.
Of course, and that's expected to be inefficient.
Quote:

> The main drivers for using Perl is it's superior
> performance in string handling and although I boiled down my problem
> to a simple example with 3 lines; my real problem entails processing
> millions of lines - that's ~1h for powershell and ~5m for Perl.
The creators of PowerShell have tons of experience with and respect for Perl.
People such as Jeffrey Snover and Bruce Payette have said so many times in
interviews or print. That being said, I respectfully suggest that you are
finding your task to be (vastly) quicker in Perl because you don't know how to
do it efficiently in PowerShell. You are not comparing apples to apples when
you "shell out" to Perl from within a PowerShell script.

Give us a chance. Why don't you start a new thread and lay out your entire
task. You can even put in the Perl code, I'm sure you'll find people that will
want to port the whole darn thing for you. After all, it's a challenge to show
off to a Perl guy.

Of course, it is entirely possible that Perl is "better" (that being a
subjective term, hence the quotes) at your particular task, but I bet everybody
would love to see it being worked through.
Quote:

> I suspect I could write my own cmdlet that keeps a non-Powershell
> process open and sends the powershell pipe stream to this process.
> Actually, do you know of any such CmdLet?
There are tons of ways to start and manage processes using PowerShell, but I'm
not sure if any will achieve your _current_ goal. See this article:

http://blogs.microsoft.co.il/blogs/s...owershell.aspx

And PowerShell Community Extensions (PSCX) has a Start-Process cmdlet.
http://codeplex.com/PowerShellCX

Please do let us see your Perl code...

--
Author, Tech Prosaic blog (http://halr9000.com)
Webmaster, Psi (http://psi-im.org)
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast (http://powerscripting.net)
My System SpecsSystem Spec