Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Citing Does setbuf() affect cout?Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

EDIT: Also I am using multiple threads, so I was hoping to reduce the need for synchronization.

Citing Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

EDIT: Also I am using multiple threads, so I was hoping to reduce the need for synchronization.

Citing Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

EDIT: Also I am using multiple threads, so I was hoping to reduce the need for synchronization.

added 100 characters in body
Source Link
jm1234567890
  • 1.7k
  • 3
  • 21
  • 29

Citing Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

EDIT: Also I am using multiple threads, so I was hoping to reduce the need for synchronization.

Citing Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

Citing Does setbuf() affect cout?

I want to increase the buffer size to improve the performance of cout (it is usually redirected to disk)

Can I do:

std::cout.rdbuf()->pubsetbuf(some_buffer, buffer_size);

And also

ios::sync_with_stdio(false);

Does this make sense?

EDIT: Also I am using multiple threads, so I was hoping to reduce the need for synchronization.

edited tags
Link
Tom Zych
  • 13.7k
  • 9
  • 38
  • 55
Source Link
jm1234567890
  • 1.7k
  • 3
  • 21
  • 29
Loading