add script load time script to readme, add .gitignore for testing file#4
Conversation
| @@ -0,0 +1 @@ | |||
| testing.js No newline at end of file | |||
There was a problem hiding this comment.
Do you have a test script?
Perhaps it would be interesting to have a test script, right?
There was a problem hiding this comment.
I have a test script I use to stay organized before it goes into the readme, its full of comments of dead code or changes i wanted to revisit.
|
I can see that this PR change some code's syntax, we can add a linter rules to have the same rules when we ara working in this project. What do you think @jhadev? |
Yes that was my fault. I used a different formatter by accident. The linter is up to you, I'm not sure what caused this. I always use prettier though. |
Validate-Preload-Async-Defer-Scripts: - Add missing fetchpriority="low" to <link rel=preload> tag in Solution 1 This was a correctness bug - preload without fetchpriority="low" still escalates network priority even if script tag has fetchpriority="low" Prefetch-Resource-Validation (comprehensive improvements): Performance optimizations: - Pre-normalize all URLs once into a Map (eliminates O(N×M) URL parsing) - Use pre-built URL map for all matching operations - Remove redundant URL parsing in nested loops - Performance improvement: ~6000 URL objects → ~200 for typical cases New validations: - Detect invalid 'as' attribute values (typos like as="scriptt") - Detect duplicate prefetch hints (same URL prefetched multiple times) - Warn about large scripts (>1MB threshold, was missing) - Validate 'as' attribute against list of valid values Improved logic: - Better cache detection: distinguish "cached" vs "unknown (CORS)" Handles case where CORS blocks timing info (both sizes === 0) - Fixed inappropriateTypes to check scripts and provide detailed reasons - Optimized isCurrentPageResource check to use pre-built map - Added seenUrls Set to track duplicates Code quality: - Added validAsValues Set with all valid 'as' attribute values - Added THRESHOLDS.largeScriptSize (1MB) for script-specific checks - Better error messages with specific size/reason for inappropriateness - Comments explaining CORS edge cases and validation logic Documentation updates: - Added "Invalid as", "Duplicate prefetch" to issue categories table - Updated "Inappropriate type" description to mention scripts - Cache status can now show "unknown (CORS)" in output Addresses issues from comprehensive code review: - URL matching performance (#8, #9 from analysis) - Invalid 'as' validation (#7) - Duplicate detection (#14) - Large script detection (#4) - Cache detection for CORS (#3) - Current page detection optimization (#6)
add script load time script to readme, add .gitignore for testing file
Validate-Preload-Async-Defer-Scripts: - Add missing fetchpriority="low" to <link rel=preload> tag in Solution 1 This was a correctness bug - preload without fetchpriority="low" still escalates network priority even if script tag has fetchpriority="low" Prefetch-Resource-Validation (comprehensive improvements): Performance optimizations: - Pre-normalize all URLs once into a Map (eliminates O(N×M) URL parsing) - Use pre-built URL map for all matching operations - Remove redundant URL parsing in nested loops - Performance improvement: ~6000 URL objects → ~200 for typical cases New validations: - Detect invalid 'as' attribute values (typos like as="scriptt") - Detect duplicate prefetch hints (same URL prefetched multiple times) - Warn about large scripts (>1MB threshold, was missing) - Validate 'as' attribute against list of valid values Improved logic: - Better cache detection: distinguish "cached" vs "unknown (CORS)" Handles case where CORS blocks timing info (both sizes === 0) - Fixed inappropriateTypes to check scripts and provide detailed reasons - Optimized isCurrentPageResource check to use pre-built map - Added seenUrls Set to track duplicates Code quality: - Added validAsValues Set with all valid 'as' attribute values - Added THRESHOLDS.largeScriptSize (1MB) for script-specific checks - Better error messages with specific size/reason for inappropriateness - Comments explaining CORS edge cases and validation logic Documentation updates: - Added "Invalid as", "Duplicate prefetch" to issue categories table - Updated "Inappropriate type" description to mention scripts - Cache status can now show "unknown (CORS)" in output Addresses issues from comprehensive code review: - URL matching performance (#8, #9 from analysis) - Invalid 'as' validation (#7) - Duplicate detection (#14) - Large script detection (#4) - Cache detection for CORS (#3) - Current page detection optimization (#6)
Might need another eye both with output and presentation but it works well for me.
Thanks,
Josh
Was going for this -
https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API#timing_resource_loading_phases