Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
## 2025-02-18 - Regex Pre-compilation in Hot Paths
**Learning:** Re-compiling regexes inside a frequently called function (like `latex_escape` which runs for every string) creates significant overhead. Pre-compiling them at module level yielded a ~3.2x speedup.
**Action:** Always look for regex compilations inside loops or frequently called functions and move them to module level constants.

## 2026-07-25 - Redundant Lowercasing in Generator Expressions
**Learning:** In Python, calling methods like `.lower()` on strings inside a comprehension or generator expression that iterates over the same text multiple times (e.g., `[kw for kw in items if kw in text.lower()]`) results in the `.lower()` operation being evaluated repeatedly for every iteration. This causes unnecessary $O(N)$ memory allocations and CPU overhead, especially on large strings.
**Action:** Cache the result of such operations outside the loop or generator expression (e.g., `text_lower = text.lower()`) and use the cached variable inside the comprehension.
4 changes: 3 additions & 1 deletion cli/generators/ats_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ def _check_readability(self, resume_data: Dict[str, Any]) -> ATSCategoryScore:
"improved",
"achieved",
]
action_verb_count = sum(1 for verb in action_verbs if verb in all_text.lower())
# Cache lowercased strings outside loops to prevent redundant O(N) allocations
# Note: all_text is already lowercased by _get_all_text
action_verb_count = sum(1 for verb in action_verbs if verb in all_text)

if action_verb_count >= 3:
details.append(f"βœ“ Uses action verbs ({action_verb_count} found)")
Expand Down
13 changes: 11 additions & 2 deletions cli/utils/yaml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ def _prioritize_skills(self, skills: Dict[str, list], technologies: list) -> Dic
for skill in section_skills:
skill_name = skill if isinstance(skill, str) else skill.get("name", "")

# Cache lowercased strings outside loops to prevent redundant O(N) allocations
skill_name_lower = skill_name.lower()

# Check if skill matches any of the technologies
if any(tech in skill_name.lower() for tech in tech_lower):
if any(tech in skill_name_lower for tech in tech_lower):
matching.append(skill)
else:
non_matching.append(skill)
Expand Down Expand Up @@ -215,6 +218,9 @@ def get_experience(self, variant: Optional[str] = None) -> list:
max_bullets = variant_config.get("max_bullets_per_job", 4)
emphasize_keywords = variant_config.get("emphasize_keywords", [])

# Cache lowercased strings outside loops to prevent redundant O(N) allocations
emphasize_keywords_lower = [kw.lower() for kw in emphasize_keywords]

filtered_exp = []
for job in experience:
if not isinstance(job, dict):
Expand All @@ -230,9 +236,12 @@ def get_experience(self, variant: Optional[str] = None) -> list:
emphasize_for = bullet.get("emphasize_for", [])
text = bullet.get("text", "")

# Cache lowercased strings outside loops to prevent redundant O(N) allocations
text_lower = text.lower()

# Include if variant is emphasized or keywords match
if variant in emphasize_for or any(
kw.lower() in text.lower() for kw in emphasize_keywords
kw in text_lower for kw in emphasize_keywords_lower
):
filtered_bullets.append(bullet)

Expand Down
Loading