{"id":18605,"date":"2018-03-14T12:53:39","date_gmt":"2018-03-14T19:53:39","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=18605"},"modified":"2019-02-18T17:48:01","modified_gmt":"2019-02-18T17:48:01","slug":"build-time-improvement-recommendation-turn-off-map-use-pdbs","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/build-time-improvement-recommendation-turn-off-map-use-pdbs\/","title":{"rendered":"Build Time Improvement Recommendation: Turn off \/MAP, use PDBs"},"content":{"rendered":"<p><a href=\"https:\/\/blogs.msdn.microsoft.com\/c\/2018\/03\/23\/\u6784\u5efa\u65f6\u95f4\u6539\u8fdb\u5efa\u8bae%ef%bc%9a\u5173\u95edmap%ef%bc%8c\u4f7f\u7528pdb\/\">\u70b9\u8fd9\u91cc\u770b\u4e2d\u6587\u7248<\/a><\/p>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"font-family: Calibri;font-size: medium\">Map file is a plaintext file that contains information about where certain names and symbols exist in\u00a0a binary produced by the linker.\u00a0It also\u00a0contain detailed information on all sections in your binary (code, data, etc.) and\u00a0which OBJ\/LIB\u00a0each symbol is\u00a0defined in. The Windows debuggers (like windbg.exe) can use map files to help locate where a program crashed based on a crash address. Map files are an old technology: with modern releases of the MSVC toolset<\/span><span style=\"font-size: medium\">,<\/span><span style=\"font-family: Calibri;font-size: medium\"> PDB (Program Database) files do everything map files do and more. <\/span><\/p>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"font-family: Calibri;font-size: medium\">Producing a map file takes a long time. If you see the <\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/reference\/map-generate-mapfile\"><span lang=\"EN\">linker switch \/MAP<\/span><\/a><span style=\"font-family: Calibri;font-size: medium\"><span lang=\"EN\"> in your build but you don\u2019t have a need for map files, you should remove the switch to speed up your build. We\u2019ve done work recently to speed up the production of a map file but generating map files will be a slow process.<\/span><\/span><\/p>\n<p align=\"LEFT\" dir=\"LTR\"><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/ide.link_.map_.option.png\"><img decoding=\"async\" width=\"848\" height=\"612\" class=\"alignnone size-full wp-image-18585\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/ide.link_.map_.option.png\" \/><\/a><\/p>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"font-family: Calibri;font-size: medium\">If you are one of the few who needs map files (for example, to quickly check whether interested set of functions or data are laid out in expected or correct order in binary)<\/span><span style=\"font-size: medium\">,<\/span><span style=\"font-family: Calibri;font-size: medium\"> rest assured that we\u2019re not removing them. However<\/span><span style=\"font-size: medium\">,<\/span><span style=\"font-family: Calibri;font-size: medium\"> here are a few points as to why you should turn off \/MAP and simply use PDBs:<\/span><\/p>\n<ul>\n<li><span style=\"font-family: Calibri;font-size: medium\">Turning off map file generation reduces your build time. Though we recently improved throughput of map file generation in full linking scenario, the linker is not able to incrementally update an existing map file produced by prior linking, which hurts incremental linking throughput. This is different for PDB file, which can be surgically updated by the linker during incremental linking.<\/span><\/li>\n<li><span style=\"font-family: Calibri;font-size: medium\">Unlike PDB files, there is no strong binding between a binary and its corresponding map file. It is difficult to track which map file is for which versioned binary.<\/span><\/li>\n<li><span style=\"font-family: Calibri;font-size: medium\">Unlike PDB files, there is no support like symbol server for map files.<\/span><\/li>\n<li><span style=\"font-family: Calibri;font-size: medium\">Information in a PDB file is a superset of what is in a map file. In practice, almost all builds will by default produce PDB files.<\/span><\/li>\n<\/ul>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"font-family: Calibri;font-size: medium\">Lastly, we have published <span lang=\"EN\"><\/span><\/span><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/x93ctkx8.aspx\">DIA APIs<\/a> <span style=\"font-family: Calibri;font-size: medium\">that <\/span><span style=\"font-family: Calibri;font-size: medium\"><span lang=\"EN\">people can use to write their own tools to retrieve from PDB file all the information that is available today in a map file.<\/span><\/span><\/p>\n<h2 align=\"LEFT\">In closing<\/h2>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"color: #454545;font-family: Calibri;font-size: medium\">We know that build throughput is important for developers and we are continuing to improve our toolset\u2019s throughput performance. You can read more about what we\u2019re doing to improve throughput in our recent\u00a0<\/span><a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2018\/01\/04\/visual-studio-2017-throughput-improvements-and-advice\"><span lang=\"EN\">Visual Studio 2017 Throughput Improvements and Advice<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\"> blog post. And remember to check your build to see if you\u2019re generating unneeded map files!<\/span><\/span><\/p>\n<p align=\"LEFT\" dir=\"LTR\"><span style=\"color: #454545;font-family: Calibri;font-size: medium\">If you have any feedback or suggestions for us, let us know. We can be reached via the comments below, via email (<\/span><a href=\"mailto:visualcpp@microsoft.com\"><span lang=\"EN\">visualcpp@microsoft.com<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\">) and you can provide feedback via<\/span><\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\"><span lang=\"EN\">\u00a0Help &gt; Report A Problem in the product<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\">, or via<\/span><\/span><a href=\"https:\/\/developercommunity.visualstudio.com\/topics\/C%2B%2B.html\"><span lang=\"EN\">\u00a0Developer Community<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\">. You can also find us on Twitter (<\/span><\/span><a href=\"https:\/\/twitter.com\/visualc\"><span lang=\"EN\">@VisualC<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\">) and Facebook (<\/span><\/span><a href=\"https:\/\/www.facebook.com\/msftvisualcpp\"><span lang=\"EN\">msftvisualcpp<\/span><\/a><span style=\"color: #454545;font-family: Calibri;font-size: medium\"><span lang=\"EN\">).<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u70b9\u8fd9\u91cc\u770b\u4e2d\u6587\u7248 Map file is a plaintext file that contains information about where certain names and symbols exist in\u00a0a binary produced by the linker.\u00a0It also\u00a0contain detailed information on all sections in your binary (code, data, etc.) and\u00a0which OBJ\/LIB\u00a0each symbol is\u00a0defined in. The Windows debuggers (like windbg.exe) can use map files to help locate where a program [&hellip;]<\/p>\n","protected":false},"author":331,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18605","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>\u70b9\u8fd9\u91cc\u770b\u4e2d\u6587\u7248 Map file is a plaintext file that contains information about where certain names and symbols exist in\u00a0a binary produced by the linker.\u00a0It also\u00a0contain detailed information on all sections in your binary (code, data, etc.) and\u00a0which OBJ\/LIB\u00a0each symbol is\u00a0defined in. The Windows debuggers (like windbg.exe) can use map files to help locate where a program [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/18605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/331"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=18605"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/18605\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=18605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=18605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=18605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}