Skip to content

Commit fd258a0

Browse files
webapp: use __slots__ to save memory (#2193)
* webapp: use __slots__ to save memory Saves around 1/3 of memory when loading functions measured by pympler/asizeof. We should apply this on the rest of the data structures as well, but we should make sure the fields in those are not assigned at any point. Signed-off-by: David Korczynski <[email protected]> * nit Signed-off-by: David Korczynski <[email protected]> --------- Signed-off-by: David Korczynski <[email protected]>
1 parent b252958 commit fd258a0

File tree

1 file changed

+10
-0
lines changed
  • tools/web-fuzzing-introspection/app/webapp

1 file changed

+10
-0
lines changed

tools/web-fuzzing-introspection/app/webapp/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ def has_introspector(self) -> bool:
104104

105105

106106
class Function:
107+
__slots__ = ('name', 'project', 'is_reached', 'runtime_code_coverage',
108+
'function_filename', 'reached_by_fuzzers',
109+
'code_coverage_url', 'accummulated_cyclomatic_complexity',
110+
'llvm_instruction_count', 'undiscovered_complexity',
111+
'function_arguments', 'function_debug_arguments',
112+
'return_type', 'function_argument_names', 'raw_function_name',
113+
'source_line_begin', 'source_line_end', 'callsites',
114+
'calldepth', 'func_signature', 'debug_data', 'is_accessible',
115+
'is_jvm_library', 'is_enum_class', 'is_static', 'need_close',
116+
'exceptions', 'asserts')
107117

108118
def __init__(self,
109119
name: str,

0 commit comments

Comments
 (0)