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 6991309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:28:57+00:00 2026-05-27T19:28:57+00:00

As we all know, in software dev, we can be asked very ambitious things

  • 0

As we all know, in software dev, we can be asked very ambitious things to do with technology.

Recently I was asked about the quickest possible way to convert 4000 documents from word to pdf. The code/software to do the conversion is in place, and it runs on a dedicated server, so the hardware is also there (this is a recurring task). But from a C# performance perspective, what is the best way to do this?

I keep thinking along the lines of breaking this up into chunks (ie 40 documents) and convert them (i.e. 40 unique documents x 1000 parellel tasks), which run at the same time. Is this the right idea, performance wise? The simplest (and longest) is a serial loop that goes through each doc.

What would you recommend? There are no language constraints so C# 4.0, LINQ etc is all available.

  • 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-27T19:28:58+00:00Added an answer on May 27, 2026 at 7:28 pm

    1000 parallel tasks? You want to run 1,000 threads concurrently? You’ll spend more time thread switching than doing actual work. If you have a quad-core machine, you should run four threads, each of which is converting a single document at a time.

    Probably the best way to start is to use a simple Parallel.ForEach, and let the runtime library worry about scheduling the tasks. Something like:

    List<string> DocumentsToConvert = new List<string>();
    // here, load the file names of all the documents you want to convert.
    // Then, process them with:
    Parallel.Foreach(DocumentsToConvert, (doc) => { ConvertDocument(doc); });
    

    You could do the same type of thing with the TPL and tasks:

    foreach (var doc in DocumentsToConvert)
    {
        // Create and start a task to convert that document
    }
    

    In either case, you let the runtime library figure out how many tasks to execute in parallel.

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

Sidebar

Related Questions

We all know you can't do the following because of ConcurrentModificationException : for (Object
I have just completed my graduation in computer science. Now I know about all
We all know the great book about design patterns known as Gang of Four,
I have taken over maintenance of a very large (>2M SLOC) software project, all
Possible Duplicate: Software Testing Tools - for java I am just reading about testing
HI all, so we all know pinch media - the spyware software ;) i'm
We all know T-SQL's string manipulation capabilities sometimes leaves much to be desired... I
We all know how to use <ctrl>-R to reverse search through history, but did
We all know that RAW pointers need to be wrapped in some form of
We all know that commenting our code is an important part of coding style

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.