# timeit

00. Numpy 시작하기
Numpy는 파이썬 라이브러리 중 하나로, 데이터과학 라이브러리의 정수라고 할 수 있다. N차원의 배열을 다루거나 수치 계산이 필요할 때 사용함 "파이썬은 느리다" 라는 단점을 보완해줌 아래와 같이 import 하여 사용할 수 있다. NumPy 홈페이지 실습 Numpy는 공식 홈페이지에서 실습해볼 수 있는 노트북 창을 제공한다. 간단한 연습을 통해 넘파이를 알아가보자. 배열 생성 np.arange(k) : 0부터 k-1까지의 숫자 배열을 생성함. dtype : 배열의 데이터 유형을 설정할 수 있음.  - time, timeit
프로파일링(Profiling) 이란? 어떤 것이 더 나은지 특정 코드의 성능을 조사함 속도가 어느정도 차이나는지 비교해볼 수 있음 %time >- 한 번 실행으로 실행되는데 소요된 time 측정 %timeit >- 여러 번 실행하여 소요된 평균 time 측정 (100000 loops) 적용 결론 : 1번 방법이 실행되는데 더 적은 시간이 소요된다. (효율적임)
[python] timeit 명령어 전격 해부
파이썬 코드의 성능을 시험해보고 싶을 때 간단하게 시도해볼 수 있는 방법 중 하나가 timeit 명령어이다. 하지만 timeit 명령어를 사용할 때 마다 각 옵션이 정확한 어떤 역할을 하는지 매번 혼동이 될 때가 있다. 앞으로는 혼동을 하지 않도록 이번 기회에 정리해보자. 다음 명령어를 기준으로 해부를 시작해보겠다. 위 명령어를 실행하게 되면 (1) "-".join(str(n) for n in range(100)) 코드를 10000번 실행시킨다. (2) 10000번 실행한 시간 / 10000을 계산 하여 평균 값을 낸다. (3) (1) ~ (2)의 과정을 3번 반복한다. (4) 3개의 평균 값 중에 가장 작은 값을 보여준다. best of 3: 28.6 usec per loop 위 과정을 실행하는 python timeit 모듈의 코드는 [timeit.main](https://github.com/python/cpython/blob/557b9a52edc4445cec2

What is %timeit in python?
"%timeit"은 ipython의 magic function이다! 신기! IPython interactive python 커맨드 쉘 tools for parallel computing Reference https://stackoverflow.com/questions/29280470/what-is-timeit-in-python https://ipython.org/ipython-doc/dev/interactive/magics.html https://ipython.org/ipython-doc/dev
(Python) timeit module
Why timeit? >timeit runs your snippet of code millions of time (default value is 1000000) so that you get the statistically most relevant measurement of code execution time! Syntax: timeit.timeit(stmt, setup, timer, number) stmt: the statement you want to measure; it defaults to ‘pass’. setup: the code that you run before running the stmt; use this to import the required modules for our code. timer: timeit.Timer object number: the number of executions you’d like to