stdio performance in tango, stdlib, and perl

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Wed Mar 21 16:41:20 PDT 2007


kris wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
> [snip]
>> (C++ makes the same mistake wrt newline.)
>>
>> 35.7s        cppcat
>>
>> I seem to remember a trick that puts some more wind into iostream's 
>> sails, so I tried that as well:
>>
>> #include <string>
>> #include <iostream>
>> using namespace std;
>>
>> int main() {
>>   cin.sync_with_stdio(false);
>>   cout.sync_with_stdio(false);
>>   string s;
>>   while (getline(std::cin, s)) {
>>     cout << s << '\n';
>>   }
>> }
>>
>> Result:
>>
>> 13.3s        cppcat
> 
> 
> Out of interest, how does the currently shipping Phobos fare in this test?

I don't have it anymore. Couldn't write a test anyway, because currently 
Phobos does not offer readln.

Andrei



More information about the Digitalmars-d mailing list