Commit graph

260 commits

Author SHA1 Message Date
hjc-puro
7c6c5edf30 add back env_config_cls 2025-05-02 09:00:57 -07:00
hjc-puro
6661e286c4 remove use_api in env_manager, log config to wandb 2025-05-02 08:52:28 -07:00
hjc-puro
8c9752b731 preserve descs 2025-05-02 06:13:45 -07:00
hjc-puro
e40dce445c remove oai key in defaults for process 2025-05-02 05:57:34 -07:00
hjc-puro
60d67d91e7 --slurm and --testing in outer namespace 2025-05-02 03:46:34 -07:00
hjc-puro
9a8ae1630b import refactor 2025-05-02 01:00:04 -07:00
hjc-puro
78cfef9daf add process subcommand 2025-05-02 03:42:10 -04:00
hjc-puro
0f966ec3fb add import 2025-05-02 03:24:14 -04:00
codeflash-ai[bot]
837ef6295d
️ Speed up function grab_exact_from_heterogeneous_queue by 1,680%
Here’s a highly optimized version of your code for both **runtime** and **memory**, based on the profile hot spots.

- **Avoid repeated summing** for checking lengths in a growing list — we keep a running sum.
- **Avoid repeatedly copying lists/dicts** by using lists of indices and marking to remove in one pass, and using set operations for fast membership checks.
- **Avoid creating lots of small dicts** and list extensions inside loops.
- **Combine related generator expressions** so costly operations are only done once.
- **Group similar linear scans** into one to minimize number of loops over `queue`.
- Use **pre-allocated lists and sets** where it saves time.

Here's the rewritten function (all comments preserved except where the code logic was changed).



**Key optimizations:**
- Only a *single pass* over queue for setup.
- No repeated `.append(dict)`; pass only indices around until the end.
- Use `.clear()` for lists inside dict to avoid reallocations.
- Use lists of lengths for O(1) access everywhere.
- Maintain a running sum for batch size check, not repeated `sum`.

This should **dramatically cut runtime**, especially at the hot spots from your line profiler output. If you need even more speed and the queue is huge/long-lived, consider reworking the data structure for the queue itself (`deque`, heap, etc.), but for code-level optimization this is near optimal for this algorithm!
2025-04-30 08:58:23 +00:00
Dakota Nous
621d00dd80 first commit 2025-04-29 12:10:10 -07:00