Optimize performance: improve scroll handlers, CSS transitions, and resource loading#107
Draft
Optimize performance: improve scroll handlers, CSS transitions, and resource loading#107
Conversation
Co-authored-by: adrianmg <589285+adrianmg@users.noreply.github.com>
Co-authored-by: adrianmg <589285+adrianmg@users.noreply.github.com>
Co-authored-by: adrianmg <589285+adrianmg@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Identify and suggest improvements to slow code
Optimize performance: improve scroll handlers, CSS transitions, and resource loading
Oct 24, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements several targeted performance optimizations to improve page load time, scroll performance, and animation rendering efficiency without changing any functionality.
Performance Improvements
JavaScript Optimizations
Passive Scroll Listeners
Added passive event listeners to scroll handlers in
assets/js/s.js:This eliminates unnecessary preventDefault checks during scrolling, reducing jank and improving scroll performance.
Cached DOM Calculations
Optimized the
scrollToItemfunction to cachewindow.pageYOffsetvalues:Reduces layout thrashing by avoiding repeated property access during animation frames.
Deferred Script Loading
Added
deferattribute to external scripts in_layouts/home.html:Scripts now load asynchronously and execute after HTML parsing, improving initial page load time.
CSS Optimizations
Specific Property Transitions
Replaced inefficient
transition: allwith targeted properties across_sass/_layout.scssand_sass/_base.scss:Reduces browser computation by only animating necessary properties (applied to 6 elements).
GPU Acceleration
Added
will-changeproperty to animated elements:Enables GPU acceleration for smoother animations.
Cleaner Keyframes
Removed empty keyframe steps and added explicit end states:
Font Loading Optimization
Implemented async font loading in
_includes/head.htmlto prevent render-blocking:Fonts now load asynchronously with fallback support for users without JavaScript.
Impact
allTesting
Files Changed
assets/js/s.js- Passive listeners, cached calculations_sass/_layout.scss- Specific transitions, GPU hints, optimized keyframes_sass/_base.scss- Specific transition properties_includes/head.html- Async font loading_layouts/home.html- Deferred script loadingpewpew.html- Code cleanup (removed invalid defer from inline script)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.