forked from PostHog/posthog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡️ Speed up clean_entity_properties() by 11%
###Why these changes? - Improved dictionary access methods to avoid multiple lookups. - Replaced `map` and `filter` functions with list comprehensions and generator expressions. - Precomputed common expressions and used them to reduce computation overhead. - Introduced `setdefault` and `pop` with default value to handle conditional assignments more efficiently. ###Correctness - The core logic and transformations of the original code were preserved. - Each function continues to produce the same output for the same input as the original. - Conditional checks and type corrections were made more concise without changing their effects. ###How is this faster? - Reduced unnecessary dictionary lookups and used direct key accesses. - Replaced multiple iterations with list comprehensions to improve iteration efficiency. - Precomputed expressions to minimize repeated computations. - Used `setdefault` and `pop` with defaults for more efficient and cleaner code.
- Loading branch information
1 parent
f49e0af
commit 6326c55
Showing
1 changed file
with
67 additions
and
44 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