generated from Pseudo-Lab/Jupyter-Book-Template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 10주차 | ||
|
||
## 싱글 프로세스 + 싱글 스레드 | ||
![alt text](week_10_single.png) | ||
|
||
## 싱글 프로세스 + 멀티 스레딩 | ||
![alt text](week_10_multi_threading.png) | ||
|
||
## 싱글 프로세스 + 멀티 스레딩 (개수 제한) | ||
![alt text](week_10_multi_threading2.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# 11주차 | ||
|
||
## Set 내부 구조 살펴보기 | ||
``` | ||
PyTypeObject PySet_Type = { | ||
PyVarObject_HEAD_INIT(&PyType_Type, 0) | ||
"set", /* tp_name */ | ||
sizeof(PySetObject), /* tp_basicsize */ | ||
0, /* tp_itemsize */ | ||
/* methods */ | ||
(destructor)set_dealloc, /* tp_dealloc */ | ||
0, /* tp_vectorcall_offset */ | ||
0, /* tp_getattr */ | ||
0, /* tp_setattr */ | ||
0, /* tp_as_async */ | ||
(reprfunc)set_repr, /* tp_repr */ | ||
&set_as_number, /* tp_as_number */ | ||
&set_as_sequence, /* tp_as_sequence */ | ||
0, /* tp_as_mapping */ | ||
PyObject_HashNotImplemented, /* tp_hash */ | ||
0, /* tp_call */ | ||
0, /* tp_str */ | ||
PyObject_GenericGetAttr, /* tp_getattro */ | ||
0, /* tp_setattro */ | ||
0, /* tp_as_buffer */ | ||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | | ||
Py_TPFLAGS_BASETYPE, /* tp_flags */ | ||
set_doc, /* tp_doc */ | ||
(traverseproc)set_traverse, /* tp_traverse */ | ||
(inquiry)set_clear_internal, /* tp_clear */ | ||
(richcmpfunc)set_richcompare, /* tp_richcompare */ | ||
offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ | ||
(getiterfunc)set_iter, /* tp_iter */ | ||
0, /* tp_iternext */ | ||
set_methods, /* tp_methods */ | ||
0, /* tp_members */ | ||
0, /* tp_getset */ | ||
0, /* tp_base */ | ||
0, /* tp_dict */ | ||
0, /* tp_descr_get */ | ||
0, /* tp_descr_set */ | ||
0, /* tp_dictoffset */ | ||
(initproc)set_init, /* tp_init */ | ||
PyType_GenericAlloc, /* tp_alloc */ | ||
set_new, /* tp_new */ | ||
PyObject_GC_Del, /* tp_free */ | ||
.tp_vectorcall = set_vectorcall, | ||
}; | ||
``` | ||
|
||
``` | ||
static void | ||
set_dealloc(PySetObject *so) | ||
{ | ||
setentry *entry; | ||
Py_ssize_t used = so->used; | ||
/* bpo-31095: UnTrack is needed before calling any callbacks */ | ||
PyObject_GC_UnTrack(so); | ||
Py_TRASHCAN_BEGIN(so, set_dealloc) | ||
if (so->weakreflist != NULL) | ||
PyObject_ClearWeakRefs((PyObject *) so); | ||
for (entry = so->table; used > 0; entry++) { | ||
if (entry->key && entry->key != dummy) { | ||
used--; | ||
Py_DECREF(entry->key); | ||
} | ||
} | ||
if (so->table != so->smalltable) | ||
PyMem_DEL(so->table); | ||
Py_TYPE(so)->tp_free(so); | ||
Py_TRASHCAN_END | ||
} | ||
``` | ||
1. set 객체는 삭제될 때(destruction), set_dealloc 함수를 호출한다. | ||
2. set_dealloc 함수는 가비지 컬렉터의 추적 대상에서 제외하고, 약한 참조 리스트를 클리어 하는 등의 작업을 한다. | ||
3. 약한 참조 리스트를 클리어한다고 해서, 약한 참조 리스트에 포함되어 있는 다른 객체들의 메모리가 해제되는 것은 아니다. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 12주차 | ||
|
||
## unittest 사용하기 | ||
![alt text](week_12.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 13주차 | ||
|
||
## pdb 실행해보기 | ||
![alt text](week_13_debug.png) | ||
|
||
## CProfile 실행해보기 | ||
![alt text](week_13_profile.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 6주차 | ||
|
||
## 프레임 객체 생성하기 | ||
![alt text](week_6.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 7주차 | ||
|
||
## tracemalloc 모듈 사용해서 직접 메모리 확인해보기 | ||
![alt text](week_7.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 8주차 | ||
|
||
## sys.getrefcount 사용해보기 | ||
![alt text](week_8.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 9주차 | ||
|
||
## 싱글 프로세스 | ||
![alt text](week_9_single.png) | ||
|
||
## 멀티 프로세스 | ||
![alt text](week_9_multi.png) | ||
|
||
## 결론 | ||
- 싱글: 1초 | ||
- 멀티: 0.48초 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import instaviz | ||
|
||
def hello(): | ||
name = 'donghee' | ||
text = 'hello ' + name | ||
return name | ||
|
||
instaviz.show(hello) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.