{"id":336994,"date":"2022-08-13T15:00:19","date_gmt":"2022-08-13T15:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336994"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336994","title":{"rendered":"<span>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0440\u0430\u0437\u0433\u043e\u043d\u044f\u0442\u044c FizzBuzz<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f <a href=\"https:\/\/habr.com\/ru\/post\/540136\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e FizzBuzz<\/a> (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0422\u0435\u0445\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u0435 2021) \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043c\u044b\u0441\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b \u0435\u0449\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c, \u043d\u043e \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b\u043e \u043d\u0435 \u0434\u043e \u0442\u043e\u0433\u043e. \u0418 \u0442\u0443\u0442 \u043c\u043d\u0435 \u043f\u0440\u0438\u043b\u0435\u0442\u0430\u0435\u0442 <a href=\"https:\/\/habr.com\/ru\/post\/682080\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0447\u0430\u0442\u043a\u0430<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1b8\/7bb\/8ee\/1b87bb8ee8efce7cbe658fa06cfabb1f.png\" width=\"1162\" height=\"644\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b8\/7bb\/8ee\/1b87bb8ee8efce7cbe658fa06cfabb1f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0447\u0435\u0445\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u043d\u044b\u0439 GCC, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u0441 <a class=\"mention\" href=\"\/users\/chepeter\">@ChePeter<\/a>.<\/p>\n<p> \u041f\u0430\u0440\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043e\u043a\u0443\u043d\u0443\u0442\u044c \u0440\u0443\u043a\u0438 \u0432 \u043a\u043e\u0434:<\/p>\n<ul>\n<li>\n<p><a class=\"mention\" href=\"\/users\/chepeter\">@ChePeter<\/a> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441 \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u043c\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c. \u041d\u043e, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u043d\u0430 i5-9400 \u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/X86_Bit_manipulation_instruction_set#BMI1_(Bit_Manipulation_Instruction_Set_1\" rel=\"noopener noreferrer nofollow\">BMI1<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 customprint2 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438\u0437 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u0434 \u043e\u0442 &#171;\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430&#187; \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 1983 \u0433\u043e\u0434\u0430: &#171;<a href=\"https:\/\/www.pbm.com\/~lindahl\/real.programmers.html\" rel=\"noopener noreferrer nofollow\">The determined Real Programmer can write FORTRAN programs in any language<\/a>&#171;. \u041c\u043e\u0433\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0432\u044c\u044e<\/p>\n<\/li>\n<li>\n<p>\u201c\u041d\u0443 \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0443\u0442 \u043d\u0435\u0447\u0435\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u044a\u0435\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0447\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u201d \u2013 \u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u044d\u0442\u0438\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c. \u041a\u0430\u043a \u0440\u0430\u0437 \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u0441\u044f, \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u0445\u043e\u0434\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0434\u0430\u043b\u0430 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 2.5 \u0440\u0430\u0437\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u044f\u044f, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u2013 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438. \u041a\u043e\u0434 \u201c\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430\u201d \u043d\u0430 \u043c\u043e\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 <code>\/dev\/null<\/code>) \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 2.337 \u0441\u0435\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u0431\u0438\u0442\u044c. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044f \u0445\u043e\u0447\u0443 \u201c\u0432\u043b\u0435\u0437\u0442\u044c\u201d \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u2013 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e 51 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043d\u0438\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u044b, \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441 \u043d\u0443\u043b\u044f. \u041d\u043e \u0438 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c, \u0433\u0434\u0435 \u0440\u0430\u0437\u0433\u0443\u043b\u044f\u0442\u044c\u0441\u044f.<\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>itoa<\/code>, \u0438 \u043e\u043d\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0434\u0435\u043b\u0438\u043b\u0430 \u0447\u0438\u0441\u043b\u043e \u043d\u0430 10. \u0426\u0438\u043a\u043b \u2013 \u043f\u043b\u043e\u0445\u043e, \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2013 \u043f\u043b\u043e\u0445\u043e, \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u0438\u0433 \u0438 \u0442\u043e, \u0438 \u0434\u0440\u0443\u0433\u043e\u0435, \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c lookup \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 999999990, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u0440\u0430\u0442\u043d\u043e\u0435 15 \u0447\u0438\u0441\u043b\u043e \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430), \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 9-\u0437\u043d\u0430\u0447\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434 10-\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f, \u043d\u0435 \u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f 5-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0442\u043e \u0435\u0441\u0442\u044c 100000 6-\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u044d\u0442\u043e \u0443\u0436\u0435 \u0442\u0435\u0440\u043f\u0438\u043c\u043e, \u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435 15 \u0447\u0438\u0441\u0435\u043b, \u0430 30, \u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0446\u0438\u0444\u0440\u0430 \u0447\u0438\u0441\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0432 30-\u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0441\u0435\u0440\u0438\u0438, \u0438 \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 8-\u0437\u043d\u0430\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u0440\u0430\u0437 \u043c\u044b \u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 lookup\u2019\u0430 \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0437 10000. \u0410 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 4 \u0431\u0430\u0439\u0442\u0430, \u043d\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0435 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u043a\u0430\u043a 32-\u0431\u0438\u0442\u043d\u044b\u0435 <code>int<\/code>&#8216;\u044b, \u0438 \u044d\u0442\u043e \u043d\u0430\u043c \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 40K, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043a\u044d\u0448, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0442\u0430\u0442\u044c.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0446\u0438\u0444\u0440\u0443 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0430 \u0441\u0435\u0440\u0438\u044f \u0443 \u043d\u0430\u0441 \u0438\u0437 30 \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 3 \u0440\u0430\u0437\u0430 \u0437\u0430 \u0441\u0435\u0440\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u0438. \u041f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u2013 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0430, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u043d\u0430\u0434\u043e \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441. \u041e\u0434\u043d\u0438\u043c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u043e\u043c \u0443\u043b\u043e\u0436\u0438\u043c \u0446\u0435\u043b\u043e\u0435 \u0441\u0442\u0430\u0434\u043e (\u0441\u0442\u0430\u044e? \u043a\u043e\u0441\u044f\u043a?) \u0437\u0430\u0439\u0446\u0435\u0432.<\/p>\n<h2>\u0421\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 FizzBuzz \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c <code>memcpy()<\/code>. \u042f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e <code>memcpy()<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u2013 \u043e\u0442 4 \u0434\u043e 10 \u0431\u0430\u0439\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0443\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u0440\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 C \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c \u0432 <code>int<\/code>\u2019\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b little endian \u043d\u0430 x86, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u044d\u0442\u0438\u0445 &#171;\u0447\u0438\u0441\u043b\u0430\u0445&#187;, \u043d\u043e \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442.<\/p>\n<h2>\u0420\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b worker\u2019\u043e\u0432<\/h2>\n<p>\u041d\u043e\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f 9-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 90% \u043d\u0430\u0448\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f 8-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u044d\u0442\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442 \u0435\u0449\u0435 9%, \u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c, \u043d\u043e \u0437\u0430\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c. \u041d\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u0447\u0438\u0441\u0435\u043b \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438. \u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0434\u0435\u0438, \u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044f\u0441\u044c \u043e\u0442 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u0430\u0436\u0435 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0434\u0432\u0443\u0445 lookup \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 10000 \u0438 \u043d\u0430 1000 \u0447\u0438\u0441\u0435\u043b (\u043d\u0430 big endian \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u043e\u0434\u043d\u043e\u0439, \u043d\u0430 little endian \u044d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u044f\u0441\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0438\u043d\u0443\u0435\u043c\u043e \u0443\u0434\u0430\u0440\u044f\u0442 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438), \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u2013 worker\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 9-\u0437\u043d\u0430\u0447\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c 90% \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f):<\/p>\n<pre><code class=\"cpp\">#define FIZZ do { *((uint64_t *)cur) = 0x0a7a7a6946; cur += 5; } while (0) #define BUZZ do { *((uint64_t *)cur) = 0x0a7a7a7542; cur += 5; } while (0) #define FIZZBUZZ do { *((uint64_t *)cur) = 0x7a7a75427a7a6946; cur += 8; *((uint8_t *)cur) = 0x0a; cur++; } while (0) #define FIZZ_BUZZ do { *((uint64_t *)cur) = 0x7a75420a7a7a6946; cur += 8; *((uint16_t *)cur) = 0x0a7a; cur += 2; } while (0) #define BUZZ_FIZZ do { *((uint64_t *)cur) = 0x7a69460a7a7a7542; cur += 8; *((uint16_t *)cur) = 0x0a7a; cur += 2; } while (0) #define DIGIT(A) do {*cur = A; cur++; *cur = '\\n'; cur ++; } while (0) #define NUM do {*((uint32_t *)cur) = high; cur += 4; *((uint32_t *)cur) = low; cur += 4; } while (0) #define NORM do { l++; if (l >= 10000) { l -= 10000; h += 1; high = table10K[h]; } low = table10K[l]; } while(0)  void *fast9(void *arg) { struct thread_data *data = (struct thread_data *)arg; char *cur = data->buf;  int first_digits = data->first \/ 10; int h = first_digits \/ 10000;    \/\/ decimal digits 1-4 int l = first_digits % 10000;    \/\/ decimal digits 5-8 uint32_t high = table10K[h]; uint32_t low = table10K[l]; for (int i = data->first; i &lt;= data->last; i += 30) { NUM; DIGIT('1');\/\/ 1 NUM; DIGIT('2');\/\/ 2 FIZZ;\/\/ 3 NUM; DIGIT('4');\/\/ 4 BUZZ_FIZZ;\/\/ 5, 6 NUM; DIGIT('7');\/\/ 7 NUM; DIGIT('8');\/\/ 8 FIZZ_BUZZ;\/\/ 9, 10 NORM; NUM; DIGIT('1');\/\/ 11 FIZZ;\/\/ 12 NUM; DIGIT('3');\/\/ 13 NUM; DIGIT('4');\/\/ 14 FIZZBUZZ;\/\/ 15 NUM; DIGIT('6');\/\/ 16 NUM; DIGIT('7');\/\/ 17 FIZZ;\/\/ 18 NUM; DIGIT('9');\/\/ 19 BUZZ_FIZZ;\/\/ 20, 21 NORM; NUM; DIGIT('2');\/\/ 22 NUM; DIGIT('3');\/\/ 23 FIZZ_BUZZ;\/\/ 24, 25 NUM; DIGIT('6');\/\/ 26 FIZZ;\/\/ 27 NUM; DIGIT('8');\/\/ 28 NUM; DIGIT('9');\/\/ 29 FIZZBUZZ;\/\/ 30 NORM; }  data->buflen = cur - data->buf; pthread_exit(NULL); } <\/code><\/pre>\n<p>\u0417\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0445\u0435\u043a\u0441\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u2013 \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u0430 Fizz \u0438 Buzz \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 little endian \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a <a href=\"https:\/\/github.com\/qrdl\/fizzbuzz\/blob\/main\/multithreaded2.c\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p> \u041d\u0443 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2013 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0443\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430\u201d?<\/p>\n<p><code>$ time .\/multithreaded2 >\/dev\/null<br \/>real 0m0.692s<br \/>user 0m2.659s<br \/>sys 0m0.033s<\/code><\/p>\n<p>\u0414\u0430, \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 3 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0418 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043f\u0440\u0438\u0442\u043e\u043c \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u0437\u0430\u043f\u0430\u0441\u043e\u043c. \u0427\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u044f \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u0442\u0435\u0441\u0442\u0430\u043c \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0436\u0435 <code>multithreaded<\/code> \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u043d\u043e \u043d\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435). \u041d\u0435 \u0437\u043d\u0430\u044e, \u0442\u043e \u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u0441\u043b\u0443\u0433\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u0433\u043e kernel&#8217;\u0430 (5.17 \u0432\u043c\u0435\u0441\u0442\u043e 4.12) \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u0433\u043e gcc (11.3 \u0432\u043c\u0435\u0441\u0442\u043e 7.5).<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/682332\/\"> https:\/\/habr.com\/ru\/post\/682332\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f <a href=\"https:\/\/habr.com\/ru\/post\/540136\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e FizzBuzz<\/a> (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0422\u0435\u0445\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u0435 2021) \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043c\u044b\u0441\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b \u0435\u0449\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c, \u043d\u043e \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b\u043e \u043d\u0435 \u0434\u043e \u0442\u043e\u0433\u043e. \u0418 \u0442\u0443\u0442 \u043c\u043d\u0435 \u043f\u0440\u0438\u043b\u0435\u0442\u0430\u0435\u0442 <a href=\"https:\/\/habr.com\/ru\/post\/682080\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0447\u0430\u0442\u043a\u0430<\/a>.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0447\u0435\u0445\u043b\u0438\u0442\u044c \u0432\u0435\u0440\u043d\u044b\u0439 GCC, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u0441 <a class=\"mention\" href=\"\/users\/chepeter\">@ChePeter<\/a>.<\/p>\n<p> \u041f\u0430\u0440\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043e\u043a\u0443\u043d\u0443\u0442\u044c \u0440\u0443\u043a\u0438 \u0432 \u043a\u043e\u0434:<\/p>\n<ul>\n<li>\n<p><a class=\"mention\" href=\"\/users\/chepeter\">@ChePeter<\/a> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441 \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u043c\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c. \u041d\u043e, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u043d\u0430 i5-9400 \u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/X86_Bit_manipulation_instruction_set#BMI1_(Bit_Manipulation_Instruction_Set_1\" rel=\"noopener noreferrer nofollow\">BMI1<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 customprint2 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438\u0437 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u0434 \u043e\u0442 &#171;\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430&#187; \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 1983 \u0433\u043e\u0434\u0430: &#171;<a href=\"https:\/\/www.pbm.com\/~lindahl\/real.programmers.html\" rel=\"noopener noreferrer nofollow\">The determined Real Programmer can write FORTRAN programs in any language<\/a>&#171;. \u041c\u043e\u0433\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0432\u044c\u044e<\/p>\n<\/li>\n<li>\n<p>\u201c\u041d\u0443 \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0442\u044c \u0442\u0443\u0442 \u043d\u0435\u0447\u0435\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u044a\u0435\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0447\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u201d \u2013 \u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d \u0441 \u044d\u0442\u0438\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c. \u041a\u0430\u043a \u0440\u0430\u0437 \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u0441\u044f, \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u0445\u043e\u0434\u0430 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0434\u0430\u043b\u0430 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 2.5 \u0440\u0430\u0437\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u044f\u044f, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u2013 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438. \u041a\u043e\u0434 \u201c\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430\u201d \u043d\u0430 \u043c\u043e\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 <code>\/dev\/null<\/code>) \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 2.337 \u0441\u0435\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u0431\u0438\u0442\u044c. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044f \u0445\u043e\u0447\u0443 \u201c\u0432\u043b\u0435\u0437\u0442\u044c\u201d \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u2013 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e 51 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043d\u0438\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u044b, \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441 \u043d\u0443\u043b\u044f. \u041d\u043e \u0438 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c, \u0433\u0434\u0435 \u0440\u0430\u0437\u0433\u0443\u043b\u044f\u0442\u044c\u0441\u044f.<\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>itoa<\/code>, \u0438 \u043e\u043d\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0434\u0435\u043b\u0438\u043b\u0430 \u0447\u0438\u0441\u043b\u043e \u043d\u0430 10. \u0426\u0438\u043a\u043b \u2013 \u043f\u043b\u043e\u0445\u043e, \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2013 \u043f\u043b\u043e\u0445\u043e, \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u0438\u0433 \u0438 \u0442\u043e, \u0438 \u0434\u0440\u0443\u0433\u043e\u0435, \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c lookup \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 999999990, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u0440\u0430\u0442\u043d\u043e\u0435 15 \u0447\u0438\u0441\u043b\u043e \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430), \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 9-\u0437\u043d\u0430\u0447\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434 10-\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f, \u043d\u0435 \u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f 5-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0442\u043e \u0435\u0441\u0442\u044c 100000 6-\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u044d\u0442\u043e \u0443\u0436\u0435 \u0442\u0435\u0440\u043f\u0438\u043c\u043e, \u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435 15 \u0447\u0438\u0441\u0435\u043b, \u0430 30, \u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0446\u0438\u0444\u0440\u0430 \u0447\u0438\u0441\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0432 30-\u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0441\u0435\u0440\u0438\u0438, \u0438 \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 8-\u0437\u043d\u0430\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u0440\u0430\u0437 \u043c\u044b \u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0430 lookup\u2019\u0430 \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0437 10000. \u0410 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 4 \u0431\u0430\u0439\u0442\u0430, \u043d\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0435 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u043a\u0430\u043a 32-\u0431\u0438\u0442\u043d\u044b\u0435 <code>int<\/code>&#8216;\u044b, \u0438 \u044d\u0442\u043e \u043d\u0430\u043c \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 40K, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043a\u044d\u0448, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0442\u0430\u0442\u044c.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0446\u0438\u0444\u0440\u0443 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0430 \u0441\u0435\u0440\u0438\u044f \u0443 \u043d\u0430\u0441 \u0438\u0437 30 \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 3 \u0440\u0430\u0437\u0430 \u0437\u0430 \u0441\u0435\u0440\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u0438. \u041f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u2013 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0430, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u043d\u0430\u0434\u043e \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441. \u041e\u0434\u043d\u0438\u043c \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u043e\u043c \u0443\u043b\u043e\u0436\u0438\u043c \u0446\u0435\u043b\u043e\u0435 \u0441\u0442\u0430\u0434\u043e (\u0441\u0442\u0430\u044e? \u043a\u043e\u0441\u044f\u043a?) \u0437\u0430\u0439\u0446\u0435\u0432.<\/p>\n<h2>\u0421\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 FizzBuzz \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c <code>memcpy()<\/code>. \u042f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e <code>memcpy()<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u2013 \u043e\u0442 4 \u0434\u043e 10 \u0431\u0430\u0439\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0443\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u0440\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 C \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c \u0432 <code>int<\/code>\u2019\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b little endian \u043d\u0430 x86, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u044d\u0442\u0438\u0445 &#171;\u0447\u0438\u0441\u043b\u0430\u0445&#187;, \u043d\u043e \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442.<\/p>\n<h2>\u0420\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b worker\u2019\u043e\u0432<\/h2>\n<p>\u041d\u043e\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f 9-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 90% \u043d\u0430\u0448\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f 8-\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u044d\u0442\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442 \u0435\u0449\u0435 9%, \u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c, \u043d\u043e \u0437\u0430\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c. \u041d\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u0447\u0438\u0441\u0435\u043b \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438. \u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0434\u0435\u0438, \u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044f\u0441\u044c \u043e\u0442 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u0430\u0436\u0435 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0434\u0432\u0443\u0445 lookup \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 10000 \u0438 \u043d\u0430 1000 \u0447\u0438\u0441\u0435\u043b (\u043d\u0430 big endian \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u043e\u0434\u043d\u043e\u0439, \u043d\u0430 little endian \u044d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u044f\u0441\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0438\u043d\u0443\u0435\u043c\u043e \u0443\u0434\u0430\u0440\u044f\u0442 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438), \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u2013 worker\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 9-\u0437\u043d\u0430\u0447\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c 90% \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f):<\/p>\n<pre><code class=\"cpp\">#define FIZZ do { *((uint64_t *)cur) = 0x0a7a7a6946; cur += 5; } while (0) #define BUZZ do { *((uint64_t *)cur) = 0x0a7a7a7542; cur += 5; } while (0) #define FIZZBUZZ do { *((uint64_t *)cur) = 0x7a7a75427a7a6946; cur += 8; *((uint8_t *)cur) = 0x0a; cur++; } while (0) #define FIZZ_BUZZ do { *((uint64_t *)cur) = 0x7a75420a7a7a6946; cur += 8; *((uint16_t *)cur) = 0x0a7a; cur += 2; } while (0) #define BUZZ_FIZZ do { *((uint64_t *)cur) = 0x7a69460a7a7a7542; cur += 8; *((uint16_t *)cur) = 0x0a7a; cur += 2; } while (0) #define DIGIT(A) do {*cur = A; cur++; *cur = '\\n'; cur ++; } while (0) #define NUM do {*((uint32_t *)cur) = high; cur += 4; *((uint32_t *)cur) = low; cur += 4; } while (0) #define NORM do { l++; if (l >= 10000) { l -= 10000; h += 1; high = table10K[h]; } low = table10K[l]; } while(0)  void *fast9(void *arg) { struct thread_data *data = (struct thread_data *)arg; char *cur = data->buf;  int first_digits = data->first \/ 10; int h = first_digits \/ 10000;    \/\/ decimal digits 1-4 int l = first_digits % 10000;    \/\/ decimal digits 5-8 uint32_t high = table10K[h]; uint32_t low = table10K[l]; for (int i = data->first; i &lt;= data->last; i += 30) { NUM; DIGIT('1');\/\/ 1 NUM; DIGIT('2');\/\/ 2 FIZZ;\/\/ 3 NUM; DIGIT('4');\/\/ 4 BUZZ_FIZZ;\/\/ 5, 6 NUM; DIGIT('7');\/\/ 7 NUM; DIGIT('8');\/\/ 8 FIZZ_BUZZ;\/\/ 9, 10 NORM; NUM; DIGIT('1');\/\/ 11 FIZZ;\/\/ 12 NUM; DIGIT('3');\/\/ 13 NUM; DIGIT('4');\/\/ 14 FIZZBUZZ;\/\/ 15 NUM; DIGIT('6');\/\/ 16 NUM; DIGIT('7');\/\/ 17 FIZZ;\/\/ 18 NUM; DIGIT('9');\/\/ 19 BUZZ_FIZZ;\/\/ 20, 21 NORM; NUM; DIGIT('2');\/\/ 22 NUM; DIGIT('3');\/\/ 23 FIZZ_BUZZ;\/\/ 24, 25 NUM; DIGIT('6');\/\/ 26 FIZZ;\/\/ 27 NUM; DIGIT('8');\/\/ 28 NUM; DIGIT('9');\/\/ 29 FIZZBUZZ;\/\/ 30 NORM; }  data->buflen = cur - data->buf; pthread_exit(NULL); } <\/code><\/pre>\n<p>\u0417\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0445\u0435\u043a\u0441\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u2013 \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u0430 Fizz \u0438 Buzz \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 little endian \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a <a href=\"https:\/\/github.com\/qrdl\/fizzbuzz\/blob\/main\/multithreaded2.c\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p> \u041d\u0443 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2013 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0443\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u043f\u0435\u043d\u0441\u0438\u043e\u043d\u0435\u0440\u0430\u201d?<\/p>\n<p><code>$ time .\/multithreaded2 >\/dev\/null<br \/>real 0m0.692s<br \/>user 0m2.659s<br \/>sys 0m0.033s<\/code><\/p>\n<p>\u0414\u0430, \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 3 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0418 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043f\u0440\u0438\u0442\u043e\u043c \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u0437\u0430\u043f\u0430\u0441\u043e\u043c. \u0427\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u044f \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u0442\u0435\u0441\u0442\u0430\u043c \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0436\u0435 <code>multithreaded<\/code> \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u043d\u043e \u043d\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435). \u041d\u0435 \u0437\u043d\u0430\u044e, \u0442\u043e \u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u0441\u043b\u0443\u0433\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u0433\u043e kernel&#8217;\u0430 (5.17 \u0432\u043c\u0435\u0441\u0442\u043e 4.12) \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u0433\u043e gcc (11.3 \u0432\u043c\u0435\u0441\u0442\u043e 7.5).<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/682332\/\"> https:\/\/habr.com\/ru\/post\/682332\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336994","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336994"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336994\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}