{"id":5133,"date":"2013-02-26T07:00:00","date_gmt":"2013-02-26T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/02\/26\/this-code-would-be-a-lot-faster-if-it-werent-for-the-synchronization\/"},"modified":"2013-02-26T07:00:00","modified_gmt":"2013-02-26T07:00:00","slug":"this-code-would-be-a-lot-faster-if-it-werent-for-the-synchronization","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20130226-00\/?p=5133","title":{"rendered":"This code would be a lot faster if it weren&#8217;t for the synchronization"},"content":{"rendered":"<p><P>\nThis is a story from a friend of a friend,\nwhich makes it probably untrue, but I still like the story.\n<\/P>\n<P>\nOne of my colleagues jokingly suggested that we could speed up\nour code by adding these lines to our project\n<\/P>\n<PRE>\n#define EnterCriticalSection(p) ((void)0)\n#define LeaveCriticalSection(p) ((void)0)\n<\/PRE>\n<P>\nI replied, &#8220;You think you&#8217;re joking, but you&#8217;re not.&#8221;\n<\/P>\n<P>\nAccording to legend, there was a project whose product\nwas running too slow,\nso they spun off a subteam to see what architectural changes\nwould help them improve their performance.\nThe subteam returned some time later with a fork of the project\nthat they had &#8220;tuned&#8221;.\nAnd it was indeed the case that the performance-tuned version\nran a lot faster.\n<\/P>\n<P>\nLater, the development team discovered that part of the &#8220;tuning&#8221;\ninvolved simply deleting all the synchronization.\nThey didn&#8217;t replace it with lock-free algorithms\nor anything that clever.\nThey just removed all the critical sections.\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a story from a friend of a friend, which makes it probably untrue, but I still like the story. One of my colleagues jokingly suggested that we could speed up our code by adding these lines to our project #define EnterCriticalSection(p) ((void)0) #define LeaveCriticalSection(p) ((void)0) I replied, &#8220;You think you&#8217;re joking, but you&#8217;re [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-5133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>This is a story from a friend of a friend, which makes it probably untrue, but I still like the story. One of my colleagues jokingly suggested that we could speed up our code by adding these lines to our project #define EnterCriticalSection(p) ((void)0) #define LeaveCriticalSection(p) ((void)0) I replied, &#8220;You think you&#8217;re joking, but you&#8217;re [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=5133"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5133\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=5133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=5133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=5133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}