Skip to content

Commit

Permalink
Merge pull request pyutils#236 from klauer/fix_cmap_performance
Browse files Browse the repository at this point in the history
get_stats: Avoid dict conversion of c_code_map for each element of code_hash_map
  • Loading branch information
Erotemic authored Aug 21, 2023
2 parents 17387b3 + 73b8385 commit e0e3440
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions line_profiler/_line_profiler.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,10 @@ cdef class LineProfiler:
"""
Return a LineStats object containing the timings.
"""
cdef dict cmap
cdef dict cmap = self._c_code_map

stats = {}
for code in self.code_hash_map:
cmap = self._c_code_map
entries = []
for entry in self.code_hash_map[code]:
entries += list(cmap[entry].values())
Expand Down

0 comments on commit e0e3440

Please sign in to comment.