@@ -17,16 +17,14 @@ msgstr ""
17
17
"Generated-By : Babel 2.17.0\n "
18
18
19
19
#: ../../library/timeit.rst:2
20
- #, fuzzy
21
20
msgid ":mod:`!timeit` --- Measure execution time of small code snippets"
22
- msgstr ":mod:`timeit` --- 작은 코드 조각의 실행 시간 측정"
21
+ msgstr ":mod:`! timeit` --- 작은 코드 조각의 실행 시간 측정"
23
22
24
23
#: ../../library/timeit.rst:7
25
24
msgid "**Source code:** :source:`Lib/timeit.py`"
26
25
msgstr "**소스 코드:** :source:`Lib/timeit.py`"
27
26
28
27
#: ../../library/timeit.rst:15
29
- #, fuzzy
30
28
msgid ""
31
29
"This module provides a simple way to time small bits of Python code. It "
32
30
"has both a :ref:`timeit-command-line-interface` as well as a "
@@ -37,7 +35,7 @@ msgid ""
37
35
msgstr ""
38
36
"이 모듈은 파이썬 코드의 작은 조각의 시간을 측정하는 간단한 방법을 제공합니다. :ref:`timeit-command-line-"
39
37
"interface`\\ 뿐만 아니라 :ref:`콜러블 <python-interface>`\\ 도 있습니다. 실행 시간을 측정에 따르는 "
40
- "흔한 함정들을 피할 수 있습니다. O'Reilly가 출판한 *Python Cookbook*\\ 에 있는 Tim Peters의 "
38
+ "흔한 함정들을 피할 수 있습니다. O'Reilly가 출판한 *Python Cookbook* 2판에 있는 Tim Peters의 "
41
39
"\" Algorithms\" 장의 개요도 참조하십시오."
42
40
43
41
#: ../../library/timeit.rst:23
@@ -61,6 +59,12 @@ msgid ""
61
59
"$ python -m timeit \" '-'.join(map(str, range(100)))\" \n"
62
60
"10000 loops, best of 5: 23.2 usec per loop"
63
61
msgstr ""
62
+ "$ python -m timeit \" '-'.join(str(n) for n in range(100))\" \n"
63
+ "10000 loops, best of 5: 30.2 usec per loop\n"
64
+ "$ python -m timeit \" '-'.join([str(n) for n in range(100)])\" \n"
65
+ "10000 loops, best of 5: 27.5 usec per loop\n"
66
+ "$ python -m timeit \" '-'.join(map(str, range(100)))\" \n"
67
+ "10000 loops, best of 5: 23.2 usec per loop"
64
68
65
69
#: ../../library/timeit.rst:37
66
70
msgid "This can be achieved from the :ref:`python-interface` with::"
@@ -78,6 +82,15 @@ msgid ""
78
82
">>> timeit.timeit('\" -\" .join(map(str, range(100)))', number=10000)\n"
79
83
"0.23702679807320237"
80
84
msgstr ""
85
+ ">>> import timeit\n"
86
+ ">>> timeit.timeit('\" -\" .join(str(n) for n in range(100))', number=10000)"
87
+ "\n"
88
+ "0.3018611848820001\n"
89
+ ">>> timeit.timeit('\" -\" .join([str(n) for n in range(100)])', "
90
+ "number=10000)\n"
91
+ "0.2727368790656328\n"
92
+ ">>> timeit.timeit('\" -\" .join(map(str, range(100)))', number=10000)\n"
93
+ "0.23702679807320237"
81
94
82
95
#: ../../library/timeit.rst:47
83
96
msgid "A callable can also be passed from the :ref:`python-interface`::"
@@ -89,6 +102,9 @@ msgid ""
89
102
"\n"
90
103
"0.19665591977536678"
91
104
msgstr ""
105
+ ">>> timeit.timeit(lambda: \" -\" .join(map(str, range(100))), number=10000)"
106
+ "\n"
107
+ "0.19665591977536678"
92
108
93
109
#: ../../library/timeit.rst:52
94
110
msgid ""
@@ -143,6 +159,8 @@ msgid ""
143
159
"seconds. An alternative, time.perf_counter_ns, returns integer "
144
160
"nanoseconds."
145
161
msgstr ""
162
+ "기본 타이머, 항상 time.perf_counter() 이고, 초 단위의 float를 반환합니다. 대안인 "
163
+ "time.perf_counter_ns 는 나노초 단위의 정수를 반환합니다."
146
164
147
165
#: ../../library/timeit.rst:95
148
166
msgid ":func:`time.perf_counter` is now the default timer."
@@ -197,7 +215,6 @@ msgstr ""
197
215
"타이밍 오버헤드가 약간 더 커집니다."
198
216
199
217
#: ../../library/timeit.rst:127
200
- #, fuzzy
201
218
msgid ""
202
219
"Time *number* executions of the main statement. This executes the setup "
203
220
"statement once, and then returns the time it takes to execute the main "
@@ -207,8 +224,8 @@ msgid ""
207
224
"function to be used are passed to the constructor."
208
225
msgstr ""
209
226
"주 문장의 *number* 실행의 시간을 측정합니다. setup 문장을 한 번 실행한 다음, 주 문장을 여러 번 실행하는 데 걸리는"
210
- " 시간을 초 단위로 float로 반환합니다. 인자는 루프를 통과하는 횟수이며, 기본값은 백만입니다. 주 문장, setup 문장 및 "
211
- "사용할 타이머 함수는 생성자에 전달됩니다."
227
+ " 시간을 반환합니다. 기본 타이머는 초 단위의 float를 반환합니다. 인자는 루프를 통과하는 횟수이며, 기본값은 백만입니다. 주 "
228
+ "문장, setup 문장 및 사용할 타이머 함수는 생성자에 전달됩니다."
212
229
213
230
#: ../../library/timeit.rst:136
214
231
msgid ""
@@ -226,14 +243,13 @@ msgstr ""
226
243
227
244
#: ../../library/timeit.rst:143
228
245
msgid "timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()"
229
- msgstr ""
246
+ msgstr "timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit() "
230
247
231
248
#: ../../library/timeit.rst:148
232
249
msgid "Automatically determine how many times to call :meth:`.timeit`."
233
250
msgstr ":meth:`.timeit`\\ 를 호출하는 횟수를 자동으로 결정합니다."
234
251
235
252
#: ../../library/timeit.rst:150
236
- #, fuzzy
237
253
msgid ""
238
254
"This is a convenience function that calls :meth:`.timeit` repeatedly so "
239
255
"that the total time >= 0.2 second, returning the eventual (number of "
@@ -302,6 +318,11 @@ msgid ""
302
318
"except Exception:\n"
303
319
" t.print_exc()"
304
320
msgstr ""
321
+ "t = Timer(...) # try/except 바깥\n"
322
+ "try:\n"
323
+ " t.timeit(...) # 또는 t.repeat(...)\n"
324
+ "except Exception:\n"
325
+ " t.print_exc()"
305
326
306
327
#: ../../library/timeit.rst:199
307
328
msgid ""
@@ -327,6 +348,8 @@ msgid ""
327
348
"python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement "
328
349
"...]"
329
350
msgstr ""
351
+ "python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement "
352
+ "...]"
330
353
331
354
#: ../../library/timeit.rst:213
332
355
msgid "Where the following options are understood:"
@@ -353,11 +376,12 @@ msgstr ""
353
376
":func:`time.process_time`\\ 을 사용합니다"
354
377
355
378
#: ../../library/timeit.rst:238
356
- #, fuzzy
357
379
msgid ""
358
380
"specify a time unit for timer output; can select ``nsec``, ``usec``, "
359
381
"``msec``, or ``sec``"
360
- msgstr "타이머 출력의 시간 단위를 지정합니다; nsec, usec, msec 또는 sec 중에서 선택할 수 있습니다."
382
+ msgstr ""
383
+ "타이머 출력의 시간 단위를 지정합니다; ``nsec``, ``usec``, ``msec`` 또는 ``sec`` 중에서 선택할 수 "
384
+ "있습니다."
361
385
362
386
#: ../../library/timeit.rst:244
363
387
msgid "print raw timing results; repeat for more digits precision"
@@ -429,6 +453,12 @@ msgid ""
429
453
"\" text.find(char)\" \n"
430
454
"1000000 loops, best of 5: 0.342 usec per loop"
431
455
msgstr ""
456
+ "$ python -m timeit -s \" text = 'sample string'; char = 'g'\" \" char in "
457
+ "text\" \n"
458
+ "5000000 loops, best of 5: 0.0877 usec per loop\n"
459
+ "$ python -m timeit -s \" text = 'sample string'; char = 'g'\" "
460
+ "\" text.find(char)\" \n"
461
+ "1000000 loops, best of 5: 0.342 usec per loop"
432
462
433
463
#: ../../library/timeit.rst:287
434
464
msgid ""
@@ -450,6 +480,13 @@ msgid ""
450
480
"char = \" g\" ')\n"
451
481
"1.7246671520006203"
452
482
msgstr ""
483
+ ">>> import timeit\n"
484
+ ">>> timeit.timeit('char in text', setup='text = \" sample string\" ; char ="
485
+ " \" g\" ')\n"
486
+ "0.41440500499993504\n"
487
+ ">>> timeit.timeit('text.find(char)', setup='text = \" sample string\" ; "
488
+ "char = \" g\" ')\n"
489
+ "1.7246671520006203"
453
490
454
491
#: ../../library/timeit.rst:302
455
492
msgid "The same can be done using the :class:`Timer` class and its methods::"
@@ -466,6 +503,14 @@ msgid ""
466
503
"[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, "
467
504
"0.3712595970846668, 0.37866875250654886]"
468
505
msgstr ""
506
+ ">>> import timeit\n"
507
+ ">>> t = timeit.Timer('char in text', setup='text = \" sample string\" ; "
508
+ "char = \" g\" ')\n"
509
+ ">>> t.timeit()\n"
510
+ "0.3955516149999312\n"
511
+ ">>> t.repeat()\n"
512
+ "[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, "
513
+ "0.3712595970846668, 0.37866875250654886]"
469
514
470
515
#: ../../library/timeit.rst:312
471
516
msgid ""
@@ -492,6 +537,17 @@ msgid ""
492
537
"$ python -m timeit \" if hasattr(int, '__bool__'): pass\" \n"
493
538
"100000 loops, best of 5: 2.23 usec per loop"
494
539
msgstr ""
540
+ "$ python -m timeit \" try:\" \" str.__bool__\" \" except AttributeError:\" "
541
+ " \" pass\" \n"
542
+ "20000 loops, best of 5: 15.7 usec per loop\n"
543
+ "$ python -m timeit \" if hasattr(str, '__bool__'): pass\" \n"
544
+ "50000 loops, best of 5: 4.26 usec per loop\n"
545
+ "\n"
546
+ "$ python -m timeit \" try:\" \" int.__bool__\" \" except AttributeError:\" "
547
+ " \" pass\" \n"
548
+ "200000 loops, best of 5: 1.43 usec per loop\n"
549
+ "$ python -m timeit \" if hasattr(int, '__bool__'): pass\" \n"
550
+ "100000 loops, best of 5: 2.23 usec per loop"
495
551
496
552
#: ../../library/timeit.rst:330
497
553
msgid ""
@@ -522,6 +578,32 @@ msgid ""
522
578
">>> timeit.timeit(stmt=s, number=100000)\n"
523
579
"0.08588060699912603"
524
580
msgstr ""
581
+ ">>> import timeit\n"
582
+ ">>> # 어트리뷰트가 없습니다\n"
583
+ ">>> s = \"\"\"\\ \n"
584
+ "... try:\n"
585
+ "... str.__bool__\n"
586
+ "... except AttributeError:\n"
587
+ "... pass\n"
588
+ "... \"\"\" \n"
589
+ ">>> timeit.timeit(stmt=s, number=100000)\n"
590
+ "0.9138244460009446\n"
591
+ ">>> s = \" if hasattr(str, '__bool__'): pass\" \n"
592
+ ">>> timeit.timeit(stmt=s, number=100000)\n"
593
+ "0.5829014980008651\n"
594
+ ">>>\n"
595
+ ">>> # 어트리뷰트가 있습니다\n"
596
+ ">>> s = \"\"\"\\ \n"
597
+ "... try:\n"
598
+ "... int.__bool__\n"
599
+ "... except AttributeError:\n"
600
+ "... pass\n"
601
+ "... \"\"\" \n"
602
+ ">>> timeit.timeit(stmt=s, number=100000)\n"
603
+ "0.04215312199994514\n"
604
+ ">>> s = \" if hasattr(int, '__bool__'): pass\" \n"
605
+ ">>> timeit.timeit(stmt=s, number=100000)\n"
606
+ "0.08588060699912603"
525
607
526
608
#: ../../library/timeit.rst:358
527
609
msgid ""
@@ -541,6 +623,13 @@ msgid ""
541
623
" import timeit\n"
542
624
" print(timeit.timeit(\" test()\" , setup=\" from __main__ import test\" ))"
543
625
msgstr ""
626
+ "def test():\n"
627
+ " \"\"\" 멍청한 테스트 함수\"\"\" \n"
628
+ " L = [i for i in range(100)]\n"
629
+ "\n"
630
+ "if __name__ == '__main__':\n"
631
+ " import timeit\n"
632
+ " print(timeit.timeit(\" test()\" , setup=\" from __main__ import test\" ))"
544
633
545
634
#: ../../library/timeit.rst:369
546
635
msgid ""
@@ -564,15 +653,21 @@ msgid ""
564
653
"import timeit\n"
565
654
"print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))"
566
655
msgstr ""
656
+ "def f(x):\n"
657
+ " return x**2\n"
658
+ "def g(x):\n"
659
+ " return x**4\n"
660
+ "def h(x):\n"
661
+ " return x**8\n"
662
+ "\n"
663
+ "import timeit\n"
664
+ "print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))"
567
665
568
666
#: ../../library/timeit.rst:9
569
667
msgid "Benchmarking"
570
- msgstr ""
668
+ msgstr "벤치마킹 "
571
669
572
670
#: ../../library/timeit.rst:9
573
671
msgid "Performance"
574
- msgstr ""
575
-
576
- #~ msgid "The default timer, which is always :func:`time.perf_counter`."
577
- #~ msgstr "기본 타이머, 항상 :func:`time.perf_counter`\\입니다."
672
+ msgstr "성능"
578
673
0 commit comments