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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:59:56+00:00 2026-05-11T05:59:56+00:00

Profiling my program and the function print is taking a lot of time to

  • 0

Profiling my program and the function print is taking a lot of time to perform. How can I send ‘raw’ byte output directly to stdout instead of using fwrite, and making it faster (need to send all 9bytes in the print() at the same time to the stdout) ?

void print(){     unsigned char temp[9];      temp[0] = matrix[0][0];     temp[1] = matrix[0][1];     temp[2] = matrix[0][2];     temp[3] = matrix[1][0];     temp[4] = matrix[1][1];     temp[5] = matrix[1][2];     temp[6] = matrix[2][0];     temp[7] = matrix[2][1];     temp[8] = matrix[2][2];      fwrite(temp,1,9,stdout); 

}

Matrix is defined globally to be a unsigned char matrix[3][3];

  • 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. 2026-05-11T05:59:57+00:00Added an answer on May 11, 2026 at 5:59 am

    IO is not an inexpensive operation. It is, in fact, a blocking operation, meaning that the OS can preempt your process when you call write to allow more CPU-bound processes to run, before the IO device you’re writing to completes the operation.

    The only lower level function you can use (if you’re developing on a *nix machine), is to use the raw write function, but even then your performance will not be that much faster than it is now. Simply put: IO is expensive.

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

Sidebar

Related Questions

After profiling a large game playing program, I have found that the library function
Through profiling I've discovered that the sprintf here takes a long time. Is there
I am profiling an application suddenly using a lot of memory, and i am
My program has this function: vector<itemPtr> Level::getItemsAt(const Point& pt) { vector<itemPtr> vect(items.size()); // copy
I have a hashing method whose operations depend on input to the function. Profiling
I am profiling a C program using Mac's Shark which shows that some of
We wrote a Delphi program that send some informations with CDO. In my Win7
I did some profiling on a program that I'm running and the thing that
I'm working on a (C++) program that has to process a lot of information
Can CLR Profiler be used for profiling ASP.NET applications?

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.