Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:47:47+00:00 2026-05-16T07:47:47+00:00

I am launching a process and writing an intruction xml file to the destination

  • 0

I am launching a process and writing an intruction xml file to the destination process over stdin. There is only 2k of data but it is taking almost half a second to transfer that much data, which seems like way too much to me. What I am measuring is the amount of time it takes the child process to consume the data.

Any suggestions for how to speed this up?

Parent process:

    ProcessStartInfo psi = new ProcessStartInfo(path, args);
    psi.CreateNoWindow = true;
    psi.UseShellExecute = false;
    psi.RedirectStandardInput = true;
    Process p = Process.Start(psi);
    p.StandardInput.Write(stdin);
    p.StandardInput.Close();

Child Process:

    Stream s = Console.OpenStandardInput();
    StreamReader sr = new StreamReader(s);
    return sr.ReadToEnd();

For the record, I did try one change where I wrote out the length of the data first and read that exact number of bytes back in to avoid waiting for the stream to close, but that didn’t affect the performance at all.

I am spawning lots of little worker processes so the extra .5 seconds per worker is killing me!

Edit: I appreciate all of the comments, but I am specifically looking for any way to improve the stdin performance. The .5s I mentioned is being measured around the child process code:

    Stopwatch sw = new Stopwatch();
    sw.Reset();
    sw.Start();
    string stdin = ReadStdIn();
    sw.Stop();
    Console.WriteLine("Elapsed time to read stdin: " + sw.ElapsedMilliseconds);

2nd Edit: In this case, spawning threads isn’t a possibility. For reasons beyond the scope of this question, I need each working to have it’s own memory space (limited to 32 bit 2gb).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:47:47+00:00Added an answer on May 16, 2026 at 7:47 am

    Have you tried doing this same thing except not reading/writing the data? Ie. measuring the time it takes your parent program to launch the child, have it prepare to run, run, and exit?

    Since your ‘child’ code looks like C# as well, it may be the overhead of loading your child exe + libraries, starting the .Net runtime, etc. that’s taking 0.5s, not the writing/reading of your data.

    That said, starting new processes on windows isn’t cheap (at least not like it is on most *nix variations). You may want to look at using threads instead of processes if you’re that concerned about the timing here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using System.Diagnostics.ProcessStartInfo to set up the parameters for launching a process from a
We are launching a website (paid subscription) and the sign up process includes entering
Launching code on document ready is a pillar of jQuery. But sometimes, lengthy operations
I am using Runtime.getRuntime().exec(test.class) to create a process and launch a test.class file. test.class:
I've been struggling with launching a java process from perl. The root of the
While launching the application in my iPhone, I need to download the data from
I am launching another process from by C# application, and came to a problem:
I'm launching a Java process (java.exe) from .Net. using Process.Start() . In addition to
I'm launching the path C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\IIS Manager.lnk via Process.Start , but it fails
I am launching a process from my application using CreateProcess API and I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.