From dad2623669166ad68f0b897b3c14f3c2c8124708 Mon Sep 17 00:00:00 2001 From: pilmo kim <68311908+why-arong@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:21:21 +0900 Subject: [PATCH] =?UTF-8?q?[=EA=B9=80=ED=95=84=EB=AA=A8]=2013=EC=A3=BC?= =?UTF-8?q?=EC=B0=A8=20=EB=AF=B8=EC=85=98=20=EC=A0=9C=EC=B6=9C=20(#123)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../13\354\243\274\354\260\250.md" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "8th_members/\352\271\200\355\225\204\353\252\250/13\354\243\274\354\260\250.md" diff --git "a/8th_members/\352\271\200\355\225\204\353\252\250/13\354\243\274\354\260\250.md" "b/8th_members/\352\271\200\355\225\204\353\252\250/13\354\243\274\354\260\250.md" new file mode 100644 index 0000000..fb327aa --- /dev/null +++ "b/8th_members/\352\271\200\355\225\204\353\252\250/13\354\243\274\354\260\250.md" @@ -0,0 +1,43 @@ +# pdb 실행 해보기 + +Screenshot 2024-06-30 at 5 23 18 PM + + + +# CProfile 예제 직접 실행해보기 + +```python3 +# example.py + +import cProfile +import pstats +import io + +def slow_function(): + total = 0 + for i in range(10000): + for j in range(10000): + total += i * j + return total + +def fast_function(): + return sum(i * j for i in range(1000) for j in range(1000)) + +def main(): + slow_function() + fast_function() + +if __name__ == '__main__': + pr = cProfile.Profile() + pr.enable() + main() + pr.disable() + + s = io.StringIO() + sortby = 'cumulative' + ps = pstats.Stats(pr, stream=s).sort_stats(sortby) + ps.print_stats() + print(s.getvalue()) + +``` +Screenshot 2024-06-30 at 5 31 22 PM