{"id":202832,"date":"2013-11-20T02:03:03","date_gmt":"2013-11-19T22:03:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=202832"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=202832","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 Python, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 <a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/201778\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0433\u0434\u0435 \u0438 \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 &mdash; \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<ul>\n<li><a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/201594\/\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0442\u0435\u043e\u0440\u0438\u044f<\/a> &mdash; \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438<\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/201778\/\">\u0420\u0443\u0447\u043d\u043e\u0435 \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a> &mdash; \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/li>\n<li><strong>\u0421\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u043e\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong> &mdash; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/li>\n<li>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 &mdash; \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/li>\n<\/ul>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 <a href=\"http:\/\/projecteuler.net\/problem=3\">\u0437\u0430\u0434\u0430\u0447\u0443 3<\/a> \u0438\u0437 <a href=\"http:\/\/projecteuler.net\/\">\u041f\u0440\u043e\u0435\u043a\u0442\u0430 \u042d\u0439\u043b\u0435\u0440\u0430<\/a>. \u0414\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/projecteuler.net\/problem=7\">\u0437\u0430\u0434\u0430\u0447\u0443 7<\/a> \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0431\u043e\u0440\u043d\u0438\u043a\u0430 \u0437\u0430\u0434\u0430\u0447:  <\/p>\n<blockquote><p>\u0412\u044b\u043f\u0438\u0441\u0430\u0432 \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043f\u043e\u043b\u0443\u0447\u0438\u043c 2, 3, 5, 7, 11 \u0438 13. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e 6-\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u2014 13.<br \/>  \u041a\u0430\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f 10001-\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c?<\/p><\/blockquote>\n<p>  \u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"python\">&quot;&quot;&quot;Project Euler problem 7 solve&quot;&quot;&quot; from __future__ import print_function import math import sys   def is_prime(num):     &quot;&quot;&quot;Checks if num is prime number&quot;&quot;&quot;     for i in range(2, int(math.sqrt(num)) + 1):         if num % i == 0:             return False     return True   def get_prime_numbers(count):     &quot;&quot;&quot;Get 'count' prime numbers&quot;&quot;&quot;     prime_numbers = [2]     next_number = 3      while len(prime_numbers) &lt; count:         if is_prime(next_number):             prime_numbers.append(next_number)         next_number += 1      return prime_numbers   if __name__ == '__main__':     try:         count = int(sys.argv[1])     except (TypeError, ValueError, IndexError):         sys.exit(&quot;Usage: euler_7.py number&quot;)     if count &lt; 1:         sys.exit(&quot;Error: number must be greater than zero&quot;)      prime_numbers = get_prime_numbers(count)     print(&quot;Answer: %d&quot; % prime_numbers[-1]) <\/code><\/pre>\n<p>  \u041f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0435\u043d, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u043b\u0443\u0447\u0448\u0435, \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 =)<\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f <a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/201778\/#comment_6970418\">\u043e\u043a\u043e\u043d\u0444\u0443\u0437\u0438\u043b\u0441\u044f<\/a> \u0438 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0430\u043c\u043e\u0433\u043e \u0432\u0430\u0436\u043d\u043e\u0433\u043e: \u0442\u0435\u0441\u0442\u043e\u0432. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u0435\u0433\u0447\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0432 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 (\u043a\u0430\u043a \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u0432\u0435\u0434\u044c \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b). \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442\u044b \u0432 \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &mdash; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"http:\/\/docs.python.org\/2\/library\/doctest.html\">doctest<\/a>. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u0441\u0442\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u0445:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u0441\u0442\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">&quot;&quot;&quot;Project Euler problem 7 solve&quot;&quot;&quot; from __future__ import print_function import math import sys   def is_prime(num):     &quot;&quot;&quot;     Checks if num is prime number.      &gt;&gt;&gt; is_prime(2)     True     &gt;&gt;&gt; is_prime(3)     True     &gt;&gt;&gt; is_prime(4)     False     &gt;&gt;&gt; is_prime(5)     True     &gt;&gt;&gt; is_prime(41)     True     &gt;&gt;&gt; is_prime(42)     False     &gt;&gt;&gt; is_prime(43)     True     &quot;&quot;&quot;     for i in range(2, int(math.sqrt(num)) + 1):         if num % i == 0:             return False     return True   def get_prime_numbers(count):     &quot;&quot;&quot;     Get 'count' prime numbers.      &gt;&gt;&gt; get_prime_numbers(1)     [2]     &gt;&gt;&gt; get_prime_numbers(2)     [2, 3]     &gt;&gt;&gt; get_prime_numbers(3)     [2, 3, 5]     &gt;&gt;&gt; get_prime_numbers(6)     [2, 3, 5, 7, 11, 13]     &gt;&gt;&gt; get_prime_numbers(9)     [2, 3, 5, 7, 11, 13, 17, 19, 23]     &gt;&gt;&gt; get_prime_numbers(19)     [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]     &quot;&quot;&quot;     prime_numbers = [2]     next_number = 3      while len(prime_numbers) &lt; count:         if is_prime(next_number):             prime_numbers.append(next_number)         next_number += 1      return prime_numbers   if __name__ == '__main__':     try:         count = int(sys.argv[1])     except (TypeError, ValueError, IndexError):         sys.exit(&quot;Usage: euler_7.py number&quot;)     if count &lt; 1:         sys.exit(&quot;Error: number must be greater than zero&quot;)      prime_numbers = get_prime_numbers(count)     print(&quot;Answer: %d&quot; % prime_numbers[-1]) <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>\u279c python -m doctest -v euler_7.py Trying:     get_prime_numbers(1) Expecting:     [2] ok Trying:     get_prime_numbers(2) Expecting:     [2, 3] ok Trying:     get_prime_numbers(3) Expecting:     [2, 3, 5] ok Trying:     get_prime_numbers(6) Expecting:     [2, 3, 5, 7, 11, 13] ok Trying:     get_prime_numbers(9) Expecting:     [2, 3, 5, 7, 11, 13, 17, 19, 23] ok Trying:     get_prime_numbers(19) Expecting:     [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67] ok Trying:     is_prime(2) Expecting:     True ok Trying:     is_prime(3) Expecting:     True ok Trying:     is_prime(4) Expecting:     False ok Trying:     is_prime(5) Expecting:     True ok Trying:     is_prime(41) Expecting:     True ok Trying:     is_prime(42) Expecting:     False ok Trying:     is_prime(43) Expecting:     True ok 1 items had no tests:     euler_7 2 items passed all tests:    6 tests in euler_7.get_prime_numbers    7 tests in euler_7.is_prime 13 tests in 3 items. 13 passed and 0 failed. Test passed. <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043e\u0434:  <\/p>\n<pre><code>\u279c python -m timeit -n 10 -s'import euler_7' 'euler_7.get_prime_numbers(10001)' 10 loops, best of 3: 1.27 sec per loop <\/code><\/pre>\n<p>  \u0414\u0430, \u043d\u0435\u0431\u044b\u0441\u0442\u0440\u043e, \u0435\u0441\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c =)<\/p>\n<h2>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>  \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python \u043f\u043e\u0440\u0430\u0436\u0430\u044e\u0442 \u0441\u0432\u043e\u0438\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435\u043c. \u0412 \u043d\u0438\u0445, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0435\u0441\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0438 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u044b \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0438\u0445 \u0446\u0435\u043b\u044b\u0445 \u0442\u0440\u0438 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb:  <\/p>\n<ul>\n<li><strong>cProfile<\/strong> &mdash; \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u044b\u0439 (\u0441 \u0432\u0435\u0440\u0441\u0438\u0438 2.5) \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 C \u0438 \u043e\u0442\u0442\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439<\/li>\n<li><strong>profile<\/strong> &mdash; \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430 (\u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c \u043f\u0438\u0442\u043e\u043d\u0435), \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e<\/li>\n<li><strong>hotshot<\/strong> &mdash; \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u0441\u0438, \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0451\u043d \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/li>\n<\/ul>\n<h3>cProfile<\/h3>\n<p>  \u041a\u0430\u043a\u043e\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0438\u0442\u043e\u043d\u0430 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u0435\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f <a href=\"http:\/\/docs.python.org\/2\/library\/profile.html\">cProfile<\/a> &mdash; \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Python?<br \/>  \u0423\u0432\u0435\u0440\u0435\u043d, \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 Python \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c cProfile:  <\/p>\n<pre><code>\u279c python -m cProfile -s time euler_7.py 10001          428978 function calls in 1.552 seconds     Ordered by: internal time     ncalls  tottime  percall  cumtime  percall filename:lineno(function)    104741    0.955    0.000    1.361    0.000 euler_7.py:7(is_prime)    104741    0.367    0.000    0.367    0.000 {range}         1    0.162    0.162    1.550    1.550 euler_7.py:32(get_prime_numbers)    104741    0.039    0.000    0.039    0.000 {math.sqrt}    104742    0.024    0.000    0.024    0.000 {len}     10000    0.003    0.000    0.003    0.000 {method 'append' of 'list' objects}         1    0.001    0.001    1.552    1.552 euler_7.py:1(&lt;module&gt;)         1    0.000    0.000    0.000    0.000 {print}         1    0.000    0.000    0.000    0.000 __future__.py:48(&lt;module&gt;)         7    0.000    0.000    0.000    0.000 __future__.py:75(__init__)         1    0.000    0.000    0.000    0.000 __future__.py:74(_Feature)         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects} <\/code><\/pre>\n<p>  <i>\u0421\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b: \u0431\u0435\u0437 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430: 1.27 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0441 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u043e\u043c: 1.55 \u0441\u0435\u043a\u0443\u043d\u0434, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 20% \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0418 \u044d\u0442\u043e \u0435\u0449\u0451 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442!<\/i><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u0430\u044f (\u043f\u043e \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438) \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>is_prime<\/strong>. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e \u00ab\u0442\u044f\u0436\u0435\u0441\u0442\u0438\u00bb \u0432\u044b\u0437\u043e\u0432 &mdash; \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>range<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 is_prime. \u0427\u0438\u0442\u0430\u0435\u043c <a href=\"http:\/\/docs.python.org\/2\/library\/functions.html#range\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 range \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430. \u0421 \u0443\u0447\u0451\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f range \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f 104741 \u0440\u0430\u0437, \u0430 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f (\u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e), \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0441\u043f\u0438\u0441\u043a\u0430, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 range \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a \u043a\u043e\u043d\u0446\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430 \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437. \u041f\u043e\u0447\u0438\u0442\u0430\u0432 \u0435\u0449\u0451 <a href=\"https:\/\/wiki.python.org\/moin\/ForLoop#Things_to_remember\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u043c\u044b \u0443\u0437\u043d\u0430\u0451\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>xrange<\/strong> \u0432 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 (\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u0440\u043a\u0430\u0437\u043c \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0432\u0435\u0434\u044c \u043b\u044e\u0431\u043e\u0439 \u043f\u0438\u0442\u043e\u043d\u0438\u0441\u0442 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e range VS xrange). \u041f\u043b\u044e\u0441\u043e\u043c \u0437\u0430\u043c\u0435\u043d\u044b range \u043d\u0430 xrange \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u044f\u0432\u043d\u0430\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 (\u044d\u0442\u0443 \u0442\u0435\u043e\u0440\u0438\u044e \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u043e\u0437\u0436\u0435). \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u044b: \u0432\u0441\u0451 \u043e\u043a, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440:  <\/p>\n<pre><code>\u279c python -m cProfile -s time euler_7.py 10001          324237 function calls in 1.010 seconds     Ordered by: internal time     ncalls  tottime  percall  cumtime  percall filename:lineno(function)    104741    0.825    0.000    0.857    0.000 euler_7.py:7(is_prime)         1    0.127    0.127    1.009    1.009 euler_7.py:32(get_prime_numbers)    104741    0.032    0.000    0.032    0.000 {math.sqrt}    104742    0.022    0.000    0.022    0.000 {len}     10000    0.003    0.000    0.003    0.000 {method 'append' of 'list' objects}         1    0.001    0.001    1.010    1.010 euler_7.py:1(&lt;module&gt;)         1    0.000    0.000    0.000    0.000 {print}         1    0.000    0.000    0.000    0.000 __future__.py:48(&lt;module&gt;)         7    0.000    0.000    0.000    0.000 __future__.py:75(__init__)         1    0.000    0.000    0.000    0.000 __future__.py:74(_Feature)         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects} <\/code><\/pre>\n<p>  1.010 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0432\u043c\u0435\u0441\u0442\u043e 1.552, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435! \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0443\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 &mdash; \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>is_prime<\/strong> \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435. \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0435\u0451 \u043f\u043e\u0437\u0436\u0435, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e, \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u044e\u0447\u043e\u043c &quot;-o&quot;:  <\/p>\n<pre><code>\u279c python -m cProfile -o euler_7.prof euler_7.py 10001 \u279c ls euler_7.prof      euler_7.py <\/code><\/pre>\n<p>  \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c:  <\/p>\n<pre><code class=\"python\">import cProfile   def profile(func):     &quot;&quot;&quot;Decorator for run function profile&quot;&quot;&quot;     def wrapper(*args, **kwargs):         profile_filename = func.__name__ + '.prof'         profiler = cProfile.Profile()         result = profiler.runcall(func, *args, **kwargs)         profiler.dump_stats(profile_filename)         return result     return wrapper   @profile def get_prime_numbers(count):     ... <\/code><\/pre>\n<p>  \u0418 \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d \u0444\u0430\u0439\u043b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u00abget_prime_numbers.prof\u00bb \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435).<\/p>\n<h3>hotshot<\/h3>\n<p>  <a href=\"http:\/\/docs.python.org\/2\/library\/hotshot.html\">hotshot<\/a> &mdash; \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c Python, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0451\u043d \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041d\u043e \u043f\u043e\u043a\u0430 \u043e\u043d \u0435\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0432\u0435\u0434\u044c \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0434\u0430\u0451\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u043e\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:  <\/p>\n<pre><code class=\"python\">import hotshot   prof = hotshot.Profile(&quot;profile_name.prof&quot;) prof.start()  # your code goes here  prof.stop() prof.close() <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430:  <\/p>\n<pre><code class=\"python\">import hotshot   def profile(func):     &quot;&quot;&quot;Decorator for run function profile&quot;&quot;&quot;     def wrapper(*args, **kwargs):         profile_filename = func.__name__ + '.prof'         profiler = hotshot.Profile(profile_filename)         profiler.start()         result = func(*args, **kwargs)         profiler.stop()         profiler.close()         return result     return wrapper   @profile def get_prime_numbers(count):     ... <\/code><\/pre>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  \u0420\u0435\u0434\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0414\u0430 \u0438 \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e: \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0432 Python \u043c\u043e\u0434\u0443\u043b\u0435\u043c <a href=\"http:\/\/docs.python.org\/2\/library\/profile.html#the-stats-class\">pstats<\/a> (\u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e <a href=\"http:\/\/ipython.org\/\">iPython<\/a>):  <\/p>\n<pre><code>\u279c ipython  In [1]: import pstats  In [2]: p = pstats.Stats('get_prime_numbers.prof')  In [3]: p.sort_stats('calls').print_stats()           324226 function calls in 1.018 seconds     Ordered by: call count     ncalls  tottime  percall  cumtime  percall filename:lineno(function)    104742    0.023    0.000    0.023    0.000 {len}    104741    0.821    0.000    0.854    0.000 euler_7.py:19(is_prime)    104741    0.034    0.000    0.034    0.000 {math.sqrt}     10000    0.003    0.000    0.003    0.000 {method 'append' of 'list' objects}         1    0.138    0.138    1.018    1.018 euler_7.py:44(get_prime_numbers) <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0441\u043e\u043b\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0430\u044f. \u0412 \u043e\u0441\u043e\u0431\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0441 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0438 \u0442\u044b\u0441\u044f\u0447\u0430\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0430\u043d\u0430\u043b\u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0422\u0430\u043a \u0443\u0436 \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043b\u044e\u0434\u0438, \u0447\u0442\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430\u043c (\u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432) \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e. \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h3>kcachegrind<\/h3>\n<p>  \u041d\u0430\u0447\u043d\u0443, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441 \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u043a\u0430\u043a <a href=\"http:\/\/kcachegrind.sourceforge.net\/\">kcachegrind<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0443\u0442\u0438\u043b\u0438\u0442\u044b <a href=\"http:\/\/valgrind.org\/docs\/manual\/cl-manual.html\">Callgrind<\/a>, \u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b Python-\u043f\u0440\u043e\u0444\u0430\u043b\u0435\u0440\u0430, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0432 kcachegrind. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b <a href=\"https:\/\/github.com\/pwaller\/pyprof2calltree\/\">pyprof2calltree<\/a>:  <\/p>\n<pre><code>\u279c pip install pyprof2calltree \u279c pyprof2calltree -i profile_results.prof -o profile_results.kgrind <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 kcachegrind, \u0431\u0435\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432 \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code>\u279c pyprof2calltree -i profile_results.prof -k <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0432\u044b\u0437\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e. \u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u043a\u0443\u0447\u0443 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/e74\/79f\/99b\/e7479f99be484a8ab9e08f0c931bc52b.png\"\/><\/p>\n<h3>RunSnakeRun<\/h3>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0438\u043d\u0433\u0430 <a href=\"http:\/\/www.vrplumber.com\/programming\/runsnakerun\/\">RunSnakeRun<\/a> \u0431\u044b\u043b\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u043e\u043c \u043f\u0438\u0442\u043e\u043d\u0430 (\u044d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0435\u0451 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f). \u041f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 kcachegrind, \u043d\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0430\u0432\u0442\u043e\u0440\u044b, \u0432\u044b\u0433\u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439:  <\/p>\n<pre><code>\u279c brew install wxwidgets \u279c pip install SquareMap RunSnakeRun <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0436\u0435:  <\/p>\n<pre><code>\u279c runsnake profile_results.prof <\/code><\/pre>\n<p>  \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0432\u0438\u0434\u0438\u043c \u043a\u0430\u0440\u0442\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043d\u044f\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/d81\/18a\/559\/d8118a55984b6459a4b2352fbc242c55.jpg\"\/><\/p>\n<p>  RunSnakeRun \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b <a href=\"https:\/\/launchpad.net\/meliae\">Meliae<\/a>:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/76a\/ac5\/f12\/76aac5f12125c49547eb89c016ef7ae2.png\"\/><\/p>\n<h3>gprof2dot<\/h3>\n<p>  \u0423\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/code.google.com\/p\/jrfonseca\/wiki\/Gprof2Dot\">gprof2dot<\/a> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0441 \u0434\u0435\u0440\u0435\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u0421\u0442\u0430\u0432\u0438\u043c \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:  <\/p>\n<pre><code>\u279c brew install graphviz \u279c pip install gprof2dot \u279c gprof2dot -f pstats profile_results.prof | dot -Tpng -o profile_results.png <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/d12\/1e9\/cd2\/d121e9cd2a2ae3a8d1117c34dd5c8633.png\"\/><\/p>\n<h2>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Django<\/h2>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Django \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/github.com\/django-extensions\/django-extensions\">django-extensions<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e\u043c\u0438\u043c\u043e \u043a\u0443\u0447\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u00abrunprofileserver\u00bb. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u0442\u0430\u0432\u0438\u043c:  <\/p>\n<pre><code>\u279c pip install django-extensions<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c application \u0432 settings.py:  <\/p>\n<pre><code class=\"python\">INSTALLED_APPS += ('django_extensions',) <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:  <\/p>\n<pre><code>\u279c python manage.py runprofileserver --use-cprofile --prof-path=\/tmp\/prof\/ <\/code><\/pre>\n<p>  \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \/tmp\/prof\/ \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0444\u0430\u0439\u043b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code>\u279c ls \/tmp\/prof\/ admin.000276ms.1374075009.prof admin.account.user.000278ms.1374075014.prof admin.jsi18n.000185ms.1374075018.prof favicon.ico.000017ms.1374075001.prof root.000073ms.1374075004.prof static.admin.css.base.css.000011ms.1374075010.prof static.admin.css.forms.css.000013ms.1374075017.prof static.admin.img.icon-yes.gif.000001ms.1374075015.prof static.admin.img.sorting-icons.gif.000001ms.1374075015.prof static.admin.js.core.js.000018ms.1374075014.prof static.admin.js.jquery.js.000003ms.1374075014.prof static.css.bootstrap-2.3.2.min.css.000061ms.1374074996.prof static.img.glyphicons-halflings.png.000001ms.1374075005.prof static.js.bootstrap-2.3.2.min.js.000004ms.1374074996.prof static.js.jquery-2.0.2.min.js.000001ms.1374074996.prof user.login.000187ms.1374075001.prof <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435: pstats, kcachegrind, RunSnakeRun \u0438\u043b\u0438 gprof2dot. \u0418\u043b\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e =)<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432 Python \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435 \u043c\u0430\u0441\u0441\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c.<\/p>\n<h2>pycallgraph<\/h2>\n<p>  <a href=\"https:\/\/github.com\/gak\/pycallgraph\/\">pycallgraph<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b Python. \u0421\u0442\u0430\u0432\u0438\u043c:  <\/p>\n<pre><code>\u279c brew install graphviz \u279c pip install pycallgraph <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:  <\/p>\n<pre><code>\u279c pycallgraph graphviz -- euler_7.py 10001 \u279c open pycallgraph.png <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/5f6\/57a\/ac4\/5f657aac48a325ae6e02631665b50f3a.png\"\/><\/p>\n<h2>line_profiler<\/h2>\n<p>  <a href=\"https:\/\/bitbucket.org\/robertkern\/line_profiler\">line_profiler<\/a>, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u043e\u0442\u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430. \u0421\u0442\u0430\u0432\u0438\u043c:  <\/p>\n<pre><code>\u279c pip install line_profiler <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u00abprofile\u00bb (\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u0431\u0440\u0430\u043b \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432):  <\/p>\n<pre><code class=\"python\">@profile def is_prime(num):     for i in xrange(2, int(math.sqrt(num)) + 1):         if num % i == 0:             return False     return True   @profile def get_prime_numbers(count):     prime_numbers = [2]     next_number = 3      while len(prime_numbers) &lt; count:         if is_prime(next_number):             prime_numbers.append(next_number)         next_number += 1      return prime_numbers <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:  <\/p>\n<pre><code>\u279c kernprof.py -v -l euler_7.py 10001 Wrote profile results to euler_7.py.lprof Timer unit: 1e-06 s  File: euler_7.py Function: is_prime at line 7 Total time: 10.7963 s  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================      7                                           @profile      8                                           def is_prime(num):      9   2935963      5187211      1.8     48.0      for i in xrange(2, int(math.sqrt(num)) + 1):     10   2925963      5421919      1.9     50.2          if num % i == 0:     11     94741       169309      1.8      1.6              return False     12     10000        17904      1.8      0.2      return True  File: euler_7.py Function: get_prime_numbers at line 15 Total time: 23.263 s  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     15                                           @profile     16                                           def get_prime_numbers(count):     17         1            5      5.0      0.0      prime_numbers = [2]     18         1            3      3.0      0.0      next_number = 3     19     20    104742       208985      2.0      0.9      while len(prime_numbers) &lt; count:     21    104741     22843717    218.1     98.2          if is_prime(next_number):     22     10000        22405      2.2      0.1              prime_numbers.append(next_number)     23    104741       187927      1.8      0.8          next_number += 1     24     25         1            2      2.0      0.0      return prime_numbers <\/code><\/pre>\n<p>  <i>\u0421\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u043c \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043e\u0432\u0435\u0440\u0445\u0435\u0434: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 30 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u0438 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u0435\u0437 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430 \u043e\u043d\u0430 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/i><\/p>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u0440\u0430\u0442\u0438\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 9 \u0438 10, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u00ab\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b\u00bb. \u0418 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u041b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u044b\u0435:  <\/p>\n<pre><code class=\"python\">def is_prime(num, prime_numbers):     &quot;&quot;&quot;     Checks if num is prime number.      &gt;&gt;&gt; is_prime(2, [])     True     &gt;&gt;&gt; is_prime(3, [2])     True     &gt;&gt;&gt; is_prime(4, [2, 3])     False     &gt;&gt;&gt; is_prime(5, [2, 3])     True     &gt;&gt;&gt; is_prime(41, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37])     True     &gt;&gt;&gt; is_prime(42, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41])     False     &gt;&gt;&gt; is_prime(43, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41])     True     &quot;&quot;&quot;     limit = int(math.sqrt(num)) + 1     for i in prime_numbers:         if i &gt; limit:             break         if num % i == 0:             return False     return True   def get_prime_numbers(count):     &quot;&quot;&quot;     Get 'count' prime numbers.      &gt;&gt;&gt; get_prime_numbers(1)     [2]     &gt;&gt;&gt; get_prime_numbers(2)     [2, 3]     &gt;&gt;&gt; get_prime_numbers(3)     [2, 3, 5]     &gt;&gt;&gt; get_prime_numbers(6)     [2, 3, 5, 7, 11, 13]     &gt;&gt;&gt; get_prime_numbers(9)     [2, 3, 5, 7, 11, 13, 17, 19, 23]     &gt;&gt;&gt; get_prime_numbers(19)     [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]     &quot;&quot;&quot;     prime_numbers = [2]     next_number = 3      while len(prime_numbers) &lt; count:         if is_prime(next_number, prime_numbers):             prime_numbers.append(next_number)         next_number += 1      return prime_numbers <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u044b, \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0451 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0437\u0430\u043c\u0435\u0440\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:  <\/p>\n<pre><code>\u279c python -m timeit -n 10 -s'import euler_7' 'euler_7.get_prime_numbers(10001)' 10 loops, best of 3: 390 msec per loop <\/code><\/pre>\n<p>  \u0423\u0441\u043a\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e\u0447\u0442\u0438 \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430, \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0449\u0451 \u0440\u0430\u0437\u043e\u043a \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:  <\/p>\n<pre><code>\u279c kernprof.py -v -l euler_7.py 10001 Wrote profile results to euler_7.py.lprof Timer unit: 1e-06 s  File: euler_7.py Function: is_prime at line 7 Total time: 4.54317 s  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================      7                                           @profile      8                                           def is_prime(num, prime_numbers):      9    104741       310160      3.0      6.8      limit = int(math.sqrt(num)) + 1     10    800694      1296045      1.6     28.5      for i in prime_numbers:     11    800692      1327770      1.7     29.2          if i &gt; limit:     12      9998        17109      1.7      0.4              break     13    790694      1409731      1.8     31.0          if num % i == 0:     14     94741       165761      1.7      3.6              return False     15     10000        16599      1.7      0.4      return True  File: euler_7.py Function: get_prime_numbers at line 18 Total time: 10.5464 s  Line #      Hits         Time  Per Hit   % Time  Line Contents ==============================================================     18                                           @profile     19                                           def get_prime_numbers(count):     20         1            4      4.0      0.0      prime_numbers = [2]     21         1            2      2.0      0.0      next_number = 3     22     23    104742       202443      1.9      1.9      while len(prime_numbers) &lt; count:     24    104741     10143489     96.8     96.2          if is_prime(next_number, prime_numbers):     25     10000        22374      2.2      0.2              prime_numbers.append(next_number)     26    104741       178074      1.7      1.7          next_number += 1     27     28         1            1      1.0      0.0      return prime_numbers <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<h2>memory_profiler<\/h2>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/fabianp\/memory_profiler\">memory_profiler<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u0430\u043a line_profiler. \u0421\u0442\u0430\u0432\u0438\u043c:  <\/p>\n<pre><code>\u279c pip install psutil memory_profiler <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:  <\/p>\n<pre><code>\u279c python -m memory_profiler euler_7.py 10001 Filename: euler_7.py  Line #    Mem usage    Increment   Line Contents ================================================     18    8.441 MiB   -0.531 MiB   @profile     19                             def get_prime_numbers(count):     20    8.445 MiB    0.004 MiB       prime_numbers = [2]     21    8.445 MiB    0.000 MiB       next_number = 3     22     23    8.973 MiB    0.527 MiB       while len(prime_numbers) &lt; count:     24                                     if is_prime(next_number, prime_numbers):     25    8.973 MiB    0.000 MiB               prime_numbers.append(next_number)     26    8.973 MiB    0.000 MiB           next_number += 1     27     28    8.973 MiB    0.000 MiB       return prime_numbers   Filename: euler_7.py  Line #    Mem usage    Increment   Line Contents ================================================      7    8.973 MiB    0.000 MiB   @profile      8                             def is_prime(num, prime_numbers):      9    8.973 MiB    0.000 MiB       limit = int(math.sqrt(num)) + 1     10    8.973 MiB    0.000 MiB       for i in prime_numbers:     11    8.973 MiB    0.000 MiB           if i &gt; limit:     12    8.973 MiB    0.000 MiB               break     13    8.973 MiB    0.000 MiB           if num % i == 0:     14    8.973 MiB    0.000 MiB               return False     15    8.973 MiB    0.000 MiB       return True <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0441\u043e\u0431\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442. \u0412\u0441\u0451 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043d\u043e\u0440\u043c\u044b.<\/p>\n<h2>\u0415\u0449\u0451 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>  \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439, \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c.  <\/p>\n<ul>\n<li><a href=\"http:\/\/www.aminus.net\/wiki\/Dowser\">Dowser<\/a> &mdash; \u043e\u0442\u043b\u0438\u0447\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><a href=\"http:\/\/guppy-pe.sourceforge.net\/\">guppy<\/a> &mdash; \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><a href=\"https:\/\/launchpad.net\/meliae\">Meliae<\/a> &mdash; \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0430\u043d\u0435\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 RunSnakeRun<\/li>\n<li><a href=\"http:\/\/pythonhosted.org\/Pympler\/muppy.html\">muppy<\/a> &mdash; \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0443\u0442\u0435\u0447\u0435\u043a \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><a href=\"http:\/\/jmdana.github.io\/memprof\/\">memprof<\/a> &mdash; \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438<\/li>\n<li><a href=\"http:\/\/mg.pov.lt\/objgraph\/\">objgraph<\/a> &mdash; \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/li>\n<\/ul>\n<p>  \u041c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043d\u0430 Python. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442 \u043c\u0435\u043d\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 Python-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u041e\u0441\u0442\u0430\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u0438!<\/p>\n<p>  <i>\u041c\u0438\u043d\u0443\u0442\u043a\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438: \u0432 \u0442\u0440\u0451\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043f\u0440\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0438\u0442\u043e\u043d\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u043e\u0432\u043e \u00ab\u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430 \u0440\u0430\u0437.<\/i>    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/202832\/\"> http:\/\/habrahabr.ru\/company\/mailru\/blog\/202832\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 <a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/201778\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0433\u0434\u0435 \u0438 \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 &mdash; \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430\u043c\u0438.<\/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-202832","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/202832","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=202832"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/202832\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}