|
Subject: [Raw Run Log] Simple C/C++ Perfometer : Copying Files Newsgroups: gmane.comp.lang.c++.perfometer Date: 2004-04-19 15:35:19 GMT (5 years, 10 weeks, 6 days, 19 hours and 46 minutes ago)
===============================
Copying files : input to output
===============================
C/C++ Performance Tests
=======================
Using Simple C/C++ Perfometer (Copying Files), Version CF-1.3
http://article.gmane.org/gmane.comp.lang.c++.perfometer/42
Environment
-----------
Windows 2000 Professional
Intel(R) Celeron(R) CPU 1.70 GHz
Compiler
---------
* GNU g++ 3.3.1 (CYGWIN); DLLs : cygwin1.dll, kernel32.dll, ntdll.dll
Test file sizes : 1000, 0000
----------------------------
Testsuites
----------
C-01 : Functions getc() and putc()
C-02 : Functions fgetc() and fputc()
C-03 : Functions fread() and fwrite()
UNIX-C-04 : Function mmap
CPP-01 : Operators >> and <<
CPP-02 : Methods get() and put()
CPP-03 : Methods sbumpc() and sputc()
CPP-04 : Method sbumpc() and operator <<
CPP-05 : Method rdbuf() and operator <<
CPP-06 : Methods read() and write() with const buffer
CPP-07 : Methods read() and write() with max buffer
CPP-08 : Method getline
CPP-09 : Method ifstream getline
CPP-10 : Method iterators (istream_iterator, ostream_iterator)
===================== Methods of copying : BEGIN =====================
ifstream in_fs;
ofstream out_fs;
FILE* in_fp;
FILE* out_fp;
int in_fd;
int out_fd;
char ch;
int ich;
char buf[4096];
size_t nread;
char* mbuf = new char [file_size];
### Method C-01 : Functions getc() and putc()
-----------------------------------------------------
while ((ich = getc(in_fp)) != EOF) putc(ich, out_fp);
-----------------------------------------------------
### Method C-02 : Functions fgetc() and fputc()
-------------------------------------------------------
while ((ich = fgetc(in_fp)) != EOF) fputc(ich, out_fp);
-------------------------------------------------------
### Method C-03 : Functions fread() and fwrite()
-------------------------------------------------------
while ((nread = fread(buf, sizeof(char), sizeof(buf), in_fp)) > 0)
{
fwrite(buf, sizeof(char), nread, out_fp);
}
-------------------------------------------------------
### Method UNIX-C-04 : Function mmap
-------------------------------------------------------
char* ptr = (char*)mmap(0, file_size, PROT_READ, MAP_SHARED, fd_in, 0);
assert (ptr != MAP_FAILED);
write(fd_out, ptr, file_size);
munmap(ptr, file_size);
-------------------------------------------------------
### Method CPP-01 : Operators >> and <<
---------------------------------
in_fs.unsetf(ios::skipws);
while (in_fs >> ch) out_fs << ch;
---------------------------------
### Method CPP-02 : Methods get() and put()
-------------------------------------
while (in_fs.get(ch)) out_fs.put(ch);
-------------------------------------
### Method CPP-03 : Methods sbumpc() and sputc()
------------------------------------------------------------------------
while ((ch = in_fs.rdbuf()->sbumpc()) != EOF) out_fs.rdbuf()->sputc(ch);
------------------------------------------------------------------------
### Method CPP-04 : Method sbumpc() and operator <<
-------------------------------
ch = in_fs.rdbuf()->sbumpc();
out_fs << ch;
while (ch != EOF)
{
out_fs << in_fs.rdbuf();
ch = in_fs.rdbuf()->sbumpc();
}
-------------------------------
### Method CPP-05 : Method rdbuf() and operator <<
------------------------
out_fs << in_fs.rdbuf();
------------------------
### Method CPP-06 : Methods read() and write() with const buffer
------------------------
while (!in_fs.eof())
{
in_fs.read (buf, sizeof(buf));
out_fs.write (buf,in_fs.gcount());
}
------------------------
### Method CPP-07 : Methods read() and write() with max buffer
------------------------
in_fs.read (mbuf, file_size);
out_fs.write (mbuf, file_size);
------------------------
### Method CPP-08 : Method getline
------------------------
while (getline (fs_in, line)) fs_out << line << '\n';
------------------------
### Method CPP-09 : Method ifstream getline
------------------------
while (fs_in.getline (buffer, sizeof(buffer))) fs_out << buffer << '\n';
------------------------
### Method CPP-10 : Method iterators (istream_iterator, ostream_iterator)
------------------------
fs_in >> noskipws;
istream_iterator<char> in(fs_in), eos;
ostream_iterator<char> out(fs_out);
copy (in, eos, out);
------------------------
===================== Methods of copying : END =======================
================ Performance tests : BEGIN ================
################
File size = 1000
################
=======================================
Simple C/C++ Perfometer : Copying files
Version CF-1.3
=======================================
----------------------
GNU gcc 3.3.1 (CYGWIN)
----------------------
YOUR COMMAND LINE : a 1000 5 750 3
### File size : 1000
### Number of runs : 3
### Number of tests : 5
### Number of repetitions : 750
### CLOCKS_PER_SEC : 1000
Run-1 of 3 : Started .....
c_01__functions_getc_putc : 47 units (0.047 secs)
c_02__functions_fgetc_fputc : 50 units (0.050 secs)
c_03__functions_fread_fwrite : 43 units (0.043 secs)
unix_c_04__mmap : 66 units (0.066 secs)
cpp_01__operators_in_out : 1878 units (1.878 secs)
cpp_02__methods_get_put : 955 units (0.955 secs)
cpp_03__methods_sbumpc_sputc : 93 units (0.093 secs)
cpp_04__method_sbumpc__op_out : 53 units (0.053 secs)
cpp_05__method_rdbuf__op_out : 53 units (0.053 secs)
cpp_06__methods_cpp_read_write__const_buf : 56 units (0.056 secs)
cpp_07__methods_cpp_read_write__max_buf : 56 units (0.056 secs)
cpp_08__method_getline : 997 units (0.997 secs)
cpp_09__method_ifstream_getline : 97 units (0.097 secs)
cpp_10__iterators : 2055 units (2.055 secs)
Run-1 of 3 : Finished
Run-2 of 3 : Started .....
c_01__functions_getc_putc : 46 units (0.046 secs)
c_02__functions_fgetc_fputc : 46 units (0.046 secs)
c_03__functions_fread_fwrite : 40 units (0.040 secs)
unix_c_04__mmap : 70 units (0.070 secs)
cpp_01__operators_in_out : 1899 units (1.899 secs)
cpp_02__methods_get_put : 954 units (0.954 secs)
cpp_03__methods_sbumpc_sputc : 100 units (0.100 secs)
cpp_04__method_sbumpc__op_out : 57 units (0.057 secs)
cpp_05__method_rdbuf__op_out : 53 units (0.053 secs)
cpp_06__methods_cpp_read_write__const_buf : 60 units (0.060 secs)
cpp_07__methods_cpp_read_write__max_buf : 56 units (0.056 secs)
cpp_08__method_getline : 1005 units (1.005 secs)
cpp_09__method_ifstream_getline : 100 units (0.100 secs)
cpp_10__iterators : 2066 units (2.066 secs)
Run-2 of 3 : Finished
Run-3 of 3 : Started .....
c_01__functions_getc_putc : 110 units (0.110 secs)
c_02__functions_fgetc_fputc : 106 units (0.106 secs)
c_03__functions_fread_fwrite : 94 units (0.094 secs)
unix_c_04__mmap : 160 units (0.160 secs)
cpp_01__operators_in_out : 4399 units (4.399 secs)
cpp_02__methods_get_put : 2223 units (2.223 secs)
cpp_03__methods_sbumpc_sputc : 226 units (0.226 secs)
cpp_04__method_sbumpc__op_out : 126 units (0.126 secs)
cpp_05__method_rdbuf__op_out : 134 units (0.134 secs)
cpp_06__methods_cpp_read_write__const_buf : 137 units (0.137 secs)
cpp_07__methods_cpp_read_write__max_buf : 133 units (0.133 secs)
cpp_08__method_getline : 2333 units (2.333 secs)
cpp_09__method_ifstream_getline : 226 units (0.226 secs)
cpp_10__iterators : 4743 units (4.743 secs)
Run-3 of 3 : Finished
#################
File size = 10000
#################
=======================================
Simple C/C++ Perfometer : Copying files
Version CF-1.3
=======================================
----------------------
GNU gcc 3.3.1 (CYGWIN)
----------------------
YOUR COMMAND LINE : a 10000 5 750 3
### File size : 10000
### Number of runs : 3
### Number of tests : 5
### Number of repetitions : 750
### CLOCKS_PER_SEC : 1000
Run-1 of 3 : Started .....
c_01__functions_getc_putc : 811 units (0.811 secs)
c_02__functions_fgetc_fputc : 874 units (0.874 secs)
c_03__functions_fread_fwrite : 674 units (0.674 secs)
unix_c_04__mmap : 360 units (0.360 secs)
cpp_01__operators_in_out : 45579 units (45.579 secs)
cpp_02__methods_get_put : 24605 units (24.605 secs)
cpp_03__methods_sbumpc_sputc : 1977 units (1.977 secs)
cpp_04__method_sbumpc__op_out : 937 units (0.937 secs)
cpp_05__method_rdbuf__op_out : 911 units (0.911 secs)
cpp_06__methods_cpp_read_write__const_buf : 954 units (0.954 secs)
cpp_07__methods_cpp_read_write__max_buf : 901 units (0.901 secs)
cpp_08__method_getline : 16811 units (16.811 secs)
cpp_09__method_ifstream_getline : 1442 units (1.442 secs)
cpp_10__iterators : 43272 units (43.272 secs)
Run-1 of 3 : Finished
Run-2 of 3 : Started .....
c_01__functions_getc_putc : 964 units (0.964 secs)
c_02__functions_fgetc_fputc : 975 units (0.975 secs)
c_03__functions_fread_fwrite : 767 units (0.767 secs)
unix_c_04__mmap : 420 units (0.420 secs)
cpp_01__operators_in_out : 47898 units (47.898 secs)
cpp_02__methods_get_put : 24215 units (24.215 secs)
cpp_03__methods_sbumpc_sputc : 1980 units (1.980 secs)
cpp_04__method_sbumpc__op_out : 931 units (0.931 secs)
cpp_05__method_rdbuf__op_out : 911 units (0.911 secs)
cpp_06__methods_cpp_read_write__const_buf : 914 units (0.914 secs)
cpp_07__methods_cpp_read_write__max_buf : 888 units (0.888 secs)
cpp_08__method_getline : 16964 units (16.964 secs)
cpp_09__method_ifstream_getline : 1495 units (1.495 secs)
cpp_10__iterators : 52261 units (52.261 secs)
Run-2 of 3 : Finished
Run-3 of 3 : Started .....
c_01__functions_getc_putc : 955 units (0.955 secs)
c_02__functions_fgetc_fputc : 977 units (0.977 secs)
c_03__functions_fread_fwrite : 794 units (0.794 secs)
unix_c_04__mmap : 424 units (0.424 secs)
cpp_01__operators_in_out : 47922 units (47.922 secs)
cpp_02__methods_get_put : 24044 units (24.044 secs)
cpp_03__methods_sbumpc_sputc : 2080 units (2.080 secs)
cpp_04__method_sbumpc__op_out : 995 units (0.995 secs)
cpp_05__method_rdbuf__op_out : 977 units (0.977 secs)
cpp_06__methods_cpp_read_write__const_buf : 998 units (0.998 secs)
cpp_07__methods_cpp_read_write__max_buf : 964 units (0.964 secs)
cpp_08__method_getline : 16874 units (16.874 secs)
cpp_09__method_ifstream_getline : 1572 units (1.572 secs)
cpp_10__iterators : 51870 units (51.870 secs)
Run-3 of 3 : Finished
================ Performance tests : END ==================
--
Alex Vinokur
mailto:alexvn <at> connect.to
http://mathforum.org/library/view/10978.html
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
|
|
|