{"id":45,"date":"2007-05-29T03:16:23","date_gmt":"2007-05-29T08:16:23","guid":{"rendered":"http:\/\/mariusbancila.ro\/blog\/?p=45"},"modified":"2007-05-29T08:31:22","modified_gmt":"2007-05-29T13:31:22","slug":"file-io-comparison-between-win32-crt-stl-and-mfc","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/","title":{"rendered":"File Read\/Write Comparison between Win32, CRT, STL and MFC"},"content":{"rendered":"<p>I have decided to make a comparison for file IO operations on Win32, CRT, STL and MFC.<\/p>\n<p>For all four libraries\/APIs I have done the profiling in the following way:<\/p>\n<ul>\n<li>open the file<\/li>\n<li>allocate the buffer used for reading<\/li>\n<li>start the timer<\/li>\n<li>read\/write from\/to the file<\/li>\n<li>stop the timer<\/li>\n<li>close the file<\/li>\n<li>release the memory<\/li>\n<\/ul>\n<p>This way, the profiling only applies on the read or write operations, not on other task such as opening and closing files, allocating or releasing memory.<\/p>\n<p>What I&#8217;ve used:<\/p>\n<ul>\n<li>Win32: functions CreateFile, ReadFile, WriteFile\u00a0and CloseHandle<\/li>\n<li>CRT: functions FILE, fopen, fread, fwrite\u00a0and fclose<\/li>\n<li>STL: for reading class std::ifstream, and methods, open(), read() and close() and for writing class std::ofstream and methods open(), write() and close()<\/li>\n<li>MFC: class CFile, and methods Open(), Read(), Write\u00a0and Close()<\/li>\n<\/ul>\n<p>I have performed the reading with different buffer sizes: 32, 64, 128, 256, 512 bytes and 1KB, 2KB, 4KB, 8KB, 16KB, 32KB, as well as with a buffer accomodating the entire file. Same buffer sizes were used for writing. For testing the write operation I also wrote the file at once. In all cases, I generated a 16MB file.<\/p>\n<p>To decide which one is better overall, I have associated a score with each result. The faster (for each buffer size) got 4 points, the next 3, 2, and 1. The bigger the sum, the more performant overall.<\/p>\n<p>I have run the program on two files for reading on a Intel(R) Pentium(R) 4 CPU at 3.20GHz, 1 GB RAM, running Windows XP, SP2. The results, representing an average of 15 runs,\u00a0are shown bellow:<\/p>\n<h4>File 1: size 2,131,287 bytes<\/h4>\n<table border=\"1\">\n<tr>\n<td><strong>Buffer Size<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>0.01917630<\/td>\n<td>0.063093700<\/td>\n<td>0.02123180<\/td>\n<td>0.064283700<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>64<\/td>\n<td>0.01474360<\/td>\n<td>0.031909200<\/td>\n<td>0.01460960<\/td>\n<td>0.032482700<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>128<\/td>\n<td>0.01118370<\/td>\n<td>0.016183700<\/td>\n<td>0.01164060<\/td>\n<td>0.016426700<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>256<\/td>\n<td>0.00929148<\/td>\n<td>0.008573490<\/td>\n<td>0.01063090<\/td>\n<td>0.008840810<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>512<\/td>\n<td>0.01071420<\/td>\n<td>0.004684040<\/td>\n<td>0.00985086<\/td>\n<td>0.004745970<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>1024<\/td>\n<td>0.00883909<\/td>\n<td>0.002584480<\/td>\n<td>0.00907385<\/td>\n<td>0.002486950<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>2048<\/td>\n<td>0.00847502<\/td>\n<td>0.001531440<\/td>\n<td>0.00894887<\/td>\n<td>0.001477660<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>4096<\/td>\n<td>0.00776395<\/td>\n<td>0.000981391<\/td>\n<td>0.00891128<\/td>\n<td>0.001009350<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>8192<\/td>\n<td>0.00740465<\/td>\n<td>0.000744340<\/td>\n<td>0.00913489<\/td>\n<td>0.000749145<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>16384<\/td>\n<td>0.00740928<\/td>\n<td>0.000604900<\/td>\n<td>0.00936410<\/td>\n<td>0.000673978<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>32768<\/td>\n<td>0.00736531<\/td>\n<td>0.000657141<\/td>\n<td>0.00837419<\/td>\n<td>0.000610040<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>file size<\/td>\n<td>0.00955846<\/td>\n<td>0.002496180<\/td>\n<td>0.00981464<\/td>\n<td>0.002428280<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td><strong>28<\/strong><\/td>\n<td><strong>38<\/strong><\/td>\n<td><strong>20<\/strong><\/td>\n<td><strong>34<\/strong><\/td>\n<\/tr>\n<\/table>\n<h4>File 2: size 110,999,662 bytes<\/h4>\n<table border=\"1\">\n<tr>\n<td><strong>Buffer Size<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>1.011360<\/td>\n<td>3.3216500<\/td>\n<td>2.47695<\/td>\n<td>3.2822700<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>64<\/td>\n<td>0.742683<\/td>\n<td>1.6815600<\/td>\n<td>0.804563<\/td>\n<td>1.6836300<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>128<\/td>\n<td>0.600344<\/td>\n<td>0.8697840<\/td>\n<td>0.639113<\/td>\n<td>0.8750610<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>256<\/td>\n<td>0.521233<\/td>\n<td>0.4661430<\/td>\n<td>0.586376<\/td>\n<td>0.4751340<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>512<\/td>\n<td>0.501420<\/td>\n<td>0.2734540<\/td>\n<td>0.532212<\/td>\n<td>0.2653010<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>1024<\/td>\n<td>0.474670<\/td>\n<td>0.1532950<\/td>\n<td>0.510266<\/td>\n<td>0.1587330<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>2048<\/td>\n<td>0.458538<\/td>\n<td>0.1012430<\/td>\n<td>0.479981<\/td>\n<td>0.1067980<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>4096<\/td>\n<td>0.432552<\/td>\n<td>0.0715536<\/td>\n<td>0.488251<\/td>\n<td>0.0774886<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>8192<\/td>\n<td>0.417481<\/td>\n<td>0.0607284<\/td>\n<td>0.467426<\/td>\n<td>0.0674372<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>16384<\/td>\n<td>0.400320<\/td>\n<td>0.0510897<\/td>\n<td>0.458111<\/td>\n<td>0.0602826<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>32768<\/td>\n<td>0.406497<\/td>\n<td>0.0503835<\/td>\n<td>0.461796<\/td>\n<td>0.0572124<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>file size<\/td>\n<td>0.523950<\/td>\n<td>0.1867240<\/td>\n<td>0.583327<\/td>\n<td>0.1828440<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td><strong>30<\/strong><\/td>\n<td><strong>39<\/strong><\/td>\n<td><strong>18<\/strong><\/td>\n<td><strong>33<\/strong><\/td>\n<\/tr>\n<\/table>\n<p>The first conclusion is that overall Win32 is the fastest, followed by MFC, then by CRT, the slowest being the STL.<\/p>\n<p>The second conclusion is that CRT is the fastest with buffer sizes smaller than 256 bytes, and then Win32 and MFC are the faster.<\/p>\n<p>The results for writing were a quite similar. Of course, running several times, can produce slight variation in the results (both for read and write).<\/p>\n<h4>File 3 : size 16,809,984<\/h4>\n<table border=\"1\">\n<tr>\n<td><strong>Buffer Size<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<td><strong>CRT<\/strong><\/td>\n<td><strong>Win32<\/strong><\/td>\n<td><strong>STL<\/strong><\/td>\n<td><strong>MFC<\/strong><\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>0.273796<\/td>\n<td>0.890973<\/td>\n<td>0.335245<\/td>\n<td>0.877301<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>64<\/td>\n<td>0.219715<\/td>\n<td>0.465254<\/td>\n<td>0.259597<\/td>\n<td>0.450076<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>128<\/td>\n<td>0.181927<\/td>\n<td>0.24715<\/td>\n<td>0.201949<\/td>\n<td>0.245169<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>256<\/td>\n<td>0.178976<\/td>\n<td>0.141146<\/td>\n<td>0.189154<\/td>\n<td>0.143666<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>512<\/td>\n<td>0.153816<\/td>\n<td>0.0872411<\/td>\n<td>0.172239<\/td>\n<td>0.0851424<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>1024<\/td>\n<td>0.148846<\/td>\n<td>0.0608282<\/td>\n<td>0.159186<\/td>\n<td>0.0601419<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>2048<\/td>\n<td>0.139997<\/td>\n<td>0.0493811<\/td>\n<td>0.150503<\/td>\n<td>0.0496117<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>4096<\/td>\n<td>0.125797<\/td>\n<td>0.0705146<\/td>\n<td>0.15275<\/td>\n<td>0.0508061<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>8192<\/td>\n<td>0.126708<\/td>\n<td>0.15708<\/td>\n<td>0.1459<\/td>\n<td>0.0655567<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>16384<\/td>\n<td>0.121919<\/td>\n<td>0.0282886<\/td>\n<td>0.14662<\/td>\n<td>0.158024<\/td>\n<td>3<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>32768<\/td>\n<td>0.124429<\/td>\n<td>0.0247259<\/td>\n<td>0.145496<\/td>\n<td>0.0267301<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>16809984<\/td>\n<td>0.148424<\/td>\n<td>0.47066<\/td>\n<td>0.146321<\/td>\n<td>0.513205<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td>\u00a0<\/td>\n<td><strong>33<\/strong><\/td>\n<td><strong>31<\/strong><\/td>\n<td><strong>23<\/strong><\/td>\n<td><strong>33<\/strong><\/td>\n<\/tr>\n<\/table>\n<p>You can download the project I used for the benchmark from <a href=\"\/archives\/cpp\/FileIOBenchmarks.zip\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have decided to make a comparison for file IO operations on Win32, CRT, STL and MFC. For all four libraries\/APIs I have done the profiling in the following way: open the file allocate the buffer used for reading start the timer read\/write from\/to the file stop the timer close the file release the memory &#8230; <a title=\"File Read\/Write Comparison between Win32, CRT, STL and MFC\" class=\"read-more\" href=\"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/\" aria-label=\"Read more about File Read\/Write Comparison between Win32, CRT, STL and MFC\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[9,7,12],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-articles_and_tutorials","category-c","category-mfc"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"File Read\/Write Comparison between Win32, CRT, STL and MFC\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2007-05-29T08:16:23+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2007-05-29T13:31:22+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"File Read\/Write Comparison between Win32, CRT, STL and MFC\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#article\",\"name\":\"File Read\\\/Write Comparison between Win32, CRT, STL and MFC\",\"headline\":\"File Read\\\/Write Comparison between Win32, CRT, STL and MFC\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"datePublished\":\"2007-05-29T03:16:23+02:00\",\"dateModified\":\"2007-05-29T08:31:22+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#webpage\"},\"articleSection\":\"Articles &amp; Tutorials, C++, MFC\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"position\":2,\"name\":\"IT\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"position\":3,\"name\":\"Software\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"position\":4,\"name\":\"C++\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/mfc\\\/#listItem\",\"name\":\"MFC\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/mfc\\\/#listItem\",\"position\":5,\"name\":\"MFC\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/mfc\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#listItem\",\"name\":\"File Read\\\/Write Comparison between Win32, CRT, STL and MFC\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#listItem\",\"position\":6,\"name\":\"File Read\\\/Write Comparison between Win32, CRT, STL and MFC\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/mfc\\\/#listItem\",\"name\":\"MFC\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/\",\"name\":\"File Read\\\/Write Comparison between Win32, CRT, STL and MFC\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2007\\\/05\\\/29\\\/file-io-comparison-between-win32-crt-stl-and-mfc\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2007-05-29T03:16:23+02:00\",\"dateModified\":\"2007-05-29T08:31:22+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"File Read\/Write Comparison between Win32, CRT, STL and MFC","description":"","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#article","name":"File Read\/Write Comparison between Win32, CRT, STL and MFC","headline":"File Read\/Write Comparison between Win32, CRT, STL and MFC","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"datePublished":"2007-05-29T03:16:23+02:00","dateModified":"2007-05-29T08:31:22+02:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#webpage"},"articleSection":"Articles &amp; Tutorials, C++, MFC"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","position":2,"name":"IT","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","position":3,"name":"Software","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","position":4,"name":"C++","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/mfc\/#listItem","name":"MFC"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/mfc\/#listItem","position":5,"name":"MFC","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/mfc\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#listItem","name":"File Read\/Write Comparison between Win32, CRT, STL and MFC"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#listItem","position":6,"name":"File Read\/Write Comparison between Win32, CRT, STL and MFC","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/mfc\/#listItem","name":"MFC"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/","name":"File Read\/Write Comparison between Win32, CRT, STL and MFC","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2007-05-29T03:16:23+02:00","dateModified":"2007-05-29T08:31:22+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"File Read\/Write Comparison between Win32, CRT, STL and MFC","og:url":"https:\/\/mariusbancila.ro\/blog\/2007\/05\/29\/file-io-comparison-between-win32-crt-stl-and-mfc\/","article:published_time":"2007-05-29T08:16:23+00:00","article:modified_time":"2007-05-29T13:31:22+00:00","twitter:card":"summary","twitter:title":"File Read\/Write Comparison between Win32, CRT, STL and MFC"},"aioseo_meta_data":{"post_id":"45","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:06:01","updated":"2025-12-12 07:11:10","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":2,"uagb_excerpt":"I have decided to make a comparison for file IO operations on Win32, CRT, STL and MFC. For all four libraries\/APIs I have done the profiling in the following way: open the file allocate the buffer used for reading start the timer read\/write from\/to the file stop the timer close the file release the memory&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/articles_and_tutorials\/\" class=\"advgb-post-tax-term\">Articles &amp; Tutorials<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/mfc\/\" class=\"advgb-post-tax-term\">MFC<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Articles &amp; Tutorials<\/span>","<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">MFC<\/span>"]}},"comment_count":"2","relative_dates":{"created":"Posted 19 years ago","modified":"Updated 19 years ago"},"absolute_dates":{"created":"Posted on May 29, 2007","modified":"Updated on May 29, 2007"},"absolute_dates_time":{"created":"Posted on May 29, 2007 3:16 am","modified":"Updated on May 29, 2007 8:31 am"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-J","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}