Commit Graph

228 Commits

Author SHA1 Message Date
codeflash-ai[bot]
7eef3f8fa7 ️ Speed up function validate_regex by 162%
Here is an optimized version of the provided Python program. The optimizations focus on improving the I/O operations, avoiding unnecessary checks, and caching the regex pattern validation.



### Explanation of Optimizations.
1. **Caching with `@lru_cache`**: The `validate_regex` function is wrapped with `@lru_cache` to cache the results of previously validated regex patterns. This prevents repeated compilation of the same regex patterns.
2. **Reading the JSON file**: I/O operations were optimized by using the `with` statement to handle file reading and writing.
3. **Avoiding repeated checks**: The unsupported patterns are checked just once per pattern, eliminating redundant operations.
4. **Batch writing**: All rules are collected in a list and written to the output file in a single operation, reducing the overhead of multiple write operations.
2025-02-09 13:59:51 +00:00
fab
1a4a2d4e42 Merge pull request #9 from fabriziosalmi/codeflash/optimize-validate_regex-m6xkx22f
️ Speed up function `validate_regex` by 9,172%
2025-02-09 13:14:25 +01:00
codeflash-ai[bot]
a3104b23c1 ️ Speed up function validate_regex by 9,172%
Changes made for optimization.
1. Added `functools.lru_cache` decorator to cache results of `validate_regex` function calls. This ensures that repeated validations of the same pattern are resolved quickly and avoid redundant regex compilations.
2025-02-09 12:07:05 +00:00
github-actions[bot]
1a98411808 Update: [Sun Feb 9 00:27:59 UTC 2025] 2025-02-09 00:27:59 +00:00
github-actions[bot]
7d2f1248c7 Update: [Sat Feb 8 00:25:04 UTC 2025] 2025-02-08 00:25:04 +00:00
github-actions[bot]
cf21042b9c Update: [Fri Feb 7 00:25:52 UTC 2025] 2025-02-07 00:25:52 +00:00
github-actions[bot]
1cebb95fc3 Update: [Thu Feb 6 00:25:50 UTC 2025] 2025-02-06 00:25:50 +00:00
github-actions[bot]
4f4fd8786e Update: [Wed Feb 5 00:25:42 UTC 2025] 2025-02-05 00:25:42 +00:00
github-actions[bot]
71e69a3a26 Update: [Tue Feb 4 00:25:09 UTC 2025] 2025-02-04 00:25:09 +00:00
fab
339a5e0350 Update test_apache_docker.yml 2025-02-03 02:05:58 +01:00
fab
c3578e4570 Update test_nginx.yml 2025-02-03 02:05:25 +01:00
fab
132380eeaf Update update_patterns.yml 2025-02-03 02:04:42 +01:00
fab
437d3a251c Update update_patterns.yml 2025-02-03 02:02:52 +01:00
github-actions[bot]
4e0dfb87e1 Update: [Mon Feb 3 00:26:12 UTC 2025] 2025-02-03 00:26:12 +00:00
github-actions[bot]
b3d0e38516 Update: [Sun Feb 2 00:27:06 UTC 2025] 2025-02-02 00:27:06 +00:00
github-actions[bot]
16e5ffb42c Update: [Sat Feb 1 00:27:37 UTC 2025] 2025-02-01 00:27:37 +00:00
github-actions[bot]
4f409f223d Update: [Fri Jan 31 00:25:27 UTC 2025] 2025-01-31 00:25:27 +00:00
github-actions[bot]
c0a6dd804a Update: [Thu Jan 30 00:24:54 UTC 2025] 2025-01-30 00:24:54 +00:00
github-actions[bot]
b242ea0619 Update: [Wed Jan 29 00:25:14 UTC 2025] 2025-01-29 00:25:14 +00:00
fabriziosalmi
f1bae07d6c feat: Generate Nginx WAF config with separate map and rule files
This commit modifies the script to output two files:
- waf_maps.conf (for http block)
- waf_rules.conf (for server block)
to avoid conflicts and provide more flexibility.

This update should fix the bugged nginx rules integration on existing setups: https://github.com/fabriziosalmi/patterns/issues/8
2025-01-28 22:41:54 +01:00
github-actions[bot]
eaf5714520 Update: [Tue Jan 28 00:25:35 UTC 2025] 2025-01-28 00:25:35 +00:00
github-actions[bot]
0e59b87df0 Update: [Mon Jan 27 00:26:20 UTC 2025] 2025-01-27 00:26:20 +00:00
github-actions[bot]
881bd34f0c Update: [Sun Jan 26 00:25:41 UTC 2025] 2025-01-26 00:25:41 +00:00
github-actions[bot]
fac08a29be Update: [Sat Jan 25 00:24:31 UTC 2025] 2025-01-25 00:24:31 +00:00
github-actions[bot]
1b5b529aaf Update: [Fri Jan 24 00:25:21 UTC 2025] 2025-01-24 00:25:21 +00:00
github-actions[bot]
a2a0049402 Update: [Thu Jan 23 00:25:20 UTC 2025] 2025-01-23 00:25:20 +00:00
github-actions[bot]
1abc68b227 Update: [Wed Jan 22 00:25:38 UTC 2025] 2025-01-22 00:25:38 +00:00
github-actions[bot]
5be5b718a6 Update: [Tue Jan 21 00:25:04 UTC 2025] 2025-01-21 00:25:04 +00:00
github-actions[bot]
1f2291133b Update: [Mon Jan 20 00:26:12 UTC 2025] 2025-01-20 00:26:12 +00:00
github-actions[bot]
57dc991ffc Update: [Sun Jan 19 00:27:39 UTC 2025] 2025-01-19 00:27:39 +00:00
github-actions[bot]
2bc6c53985 Update: [Sat Jan 18 00:24:13 UTC 2025] 2025-01-18 00:24:13 +00:00
fab
9ccac4241f Update test_nginx.yml 2025-01-17 13:30:09 +01:00
fab
05571dad86 Update test_apache_docker.yml 2025-01-17 13:29:22 +01:00
fab
146335721c Update and rename test_docker.yml to test_apache_docker.yml 2025-01-17 13:28:23 +01:00
fab
0d92cd36c6 Update test_docker.yml 2025-01-17 12:04:59 +01:00
fab
961d42a11f Update test_docker.yml 2025-01-17 12:03:05 +01:00
fab
ddb39751e8 Update test_docker.yml
nginx & haproxy tests temp removed
2025-01-17 12:02:39 +01:00
fab
4eccf10943 Update test_docker.yml 2025-01-17 12:00:27 +01:00
github-actions[bot]
daeb6d2048 Update: [Fri Jan 17 00:25:08 UTC 2025] 2025-01-17 00:25:08 +00:00
fab
cf1a4da2bd Rename nginx.yml to test_nginx.yml 2025-01-16 19:19:08 +01:00
fab
45d9f34241 Rename test.yml to test_docker.yml 2025-01-16 19:18:58 +01:00
fabriziosalmi
ae9c2756f7 test 2025-01-16 14:38:01 +01:00
fabriziosalmi
bc5eb455bf test 2025-01-16 14:33:59 +01:00
fabriziosalmi
3297168bec test 2025-01-16 14:31:04 +01:00
fabriziosalmi
64e14d23ef test 2025-01-16 14:28:30 +01:00
fabriziosalmi
84c4a49c2d action (crossplane) 2025-01-16 14:20:25 +01:00
fabriziosalmi
cc0a8de6c2 action 2025-01-16 14:19:16 +01:00
fabriziosalmi
99ee7c07fb action 2025-01-16 14:17:49 +01:00
fabriziosalmi
69dbb9caa6 action fix 2025-01-16 14:15:40 +01:00
fab
d2a51a1e17 Update nginx.yml 2025-01-16 14:10:54 +01:00