The browser is lagging behind a few frames when repainting on high-resolution displays

Currently, I'm working on a website that features an infinite grid. Users have the ability to navigate through the grid by simply holding down the right click on their mouse and moving it around.

The technical details: To achieve this functionality, I have utilized the CSS properties position: absolute, top, and left, adjusting them accordingly. For the background lines, I have employed the background-position property. Additionally, I have implemented requestAnimationFrom on the mouseMove event for smooth movement.

The issue I'm facing: While the grid operates smoothly at 1080p resolution, there is a noticeable lag when using a 1440p resolution. This lag is not caused by FPS fluctuations, as the performance remains consistent at both resolutions. Rather, when moving the mouse, there is a delay of approximately 0.5 seconds before the grid responds. I am seeking advice on how to rectify this delay.

Here is a visual representation of the grid: https://i.sstatic.net/lkIdk.png

For those interested in testing the grid themselves, I have provided a demo: (Simply hold right click and move the mouse quickly).

Initially, I suspected that this delay was due to my 244Hz screen refresh rate. Despite implementing a throttle to 60FPS, the issue persisted.

I have also experimented with CSS properties such as will-change and transform: translateZ(0) without any success.

Considering my hardware specifications:

  • Ryzen 9 7945HX processor (up to 5.4GHz)
  • RTX4080 graphics card (laptop variant)

Answer №1

Hooray! After some searching, I finally figured it out! Turns out the issue was caused by the grid background I was using that had a background-image filled with numerous linear-gradient functions.

Realizing this is quite inefficient, I've decided to switch it out for a canvas instead.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with my Express app due to errors popping up because of the order of my routes

app.get('/campgrounds/:id/edit', async (req,res) =>{ const campground = await Campground.findById(req.params.id) res.render('campgrounds/edit', { campground }); }) app.get('/campgrounds/:id', async (req,res) =>{ ...

Is it possible to enable sorting for every column in the b-table component?

After reviewing the information on sorting per column in the bootstrap-vue documentation, I am curious if it is possible to enable sorting for the entire table. ...

What could be causing Vue.js to malfunction when attempting to run it?

Having trouble starting my Vue.js application. Encountering the following error: C:\xampp\htdocs\crm-front>npm run dev > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd9e8f90d09b8f929389bdccd3cdd3c ...

React - Unable to perform 'removeChild' on 'Node' object: The specified node cannot be removed as it is not a child of this node

I am encountering an issue in my React project with the following structure: <div className="App"> <BrowserRouter> <BasicLayout title={"test"}> <Routes> <Route path="/home&qu ...

Looking for assistance with transferring a JavaScript array to my PHP script

Is there an easier way to transfer a JavaScript array to a PHP file? I've seen examples of using AJAX for this task, but I'm wondering if there's a simpler method. Below is a snippet of the code I'm working with: <html> <hea ...

Extract JSON data from a third-party website using JavaScript

I'm facing a challenge parsing JSON from an external website using JavaScript or jQuery for a Chrome extension. Specifically, I need to extract the number from an external URL with the JSON {"_visitor_alertsUnread":"0"} and assign that number to a var ...

Explore a nested array of objects to identify and retrieve the complete pathway for every matching item

Looking for a solution to search through a deeply nested array of objects and retrieve the paths of all matching objects? While I have made progress on the problem, the current code only returns the path of the first matched object. Take a look at the inpu ...

Ensure that column headers remain fixed when scrolling side to side

I'm trying to adjust the column headers so that I can scroll horizontally while keeping the headers visible. I've attempted the following changes but haven't been successful. In the screenshots provided, you can see that when I scroll up or ...

Incorporate a Background Using PHP

There is a form on my website that includes a drop-down menu like this: <select name="status" class="form-control" style="width:100px; float:left;"> <option value="0" <?php if($status == 0)echo 'selected="selected"';?>& ...

efficiency of a process during ng-repeat execution

Do you see a distinction in how ng-repeat is written in these two examples? <div ng-repeat="item in getItems()"> Versus this: <div ng-repeat="item in items"> Imagine getItems is structured like this: $scope.getItems = function() { return ...

Mobile devices are failing to display the logo as expected

Can anyone help me figure out why the logo is not displaying on mobile devices? I've already tried resetting my phone's network and web browser, as well as reducing the size of the logo from 100px to 80px. Despite these efforts, the logo still wo ...

Three divs are set in place, with two of them of fixed width while the third div is

Looking for a layout with specific positioning and fixed widths: One box on the left, one box on the right, each with a width of 200px. The middle div should adjust to take up the remaining space. Any suggestions are appreciated. Thank you! ...

Attempting to utilize the Optimist API's help() function to display the usage() information

I am relatively new to using optimist and despite my attempts at researching and experimenting, I have been unable to find a streamlined method for incorporating a --help option. In the documentation, there is mention of a help() function. Based on this i ...

Troubleshooting issues with gh-pages in Nuxt.js

Working on a project in nuxt.js was going smoothly until I tried to deploy it on gh-pages using npm install gh-pages --save-dev. After adding some code to packed.json, everything seemed fine and I could view my project on gh-pages: However, all of a sudde ...

Extracting a subclass from an array

Currently, I am delving into the world of coding as part of a project I'm working on. Here is an excerpt from my JavaScript code that interacts with Google Maps API: for (i = 0; i < results.length; i++) { console.log("Formatted Address: "+ re ...

The clear icon in React will only appear when there is a value inputted

Is there a way to implement the clear X icon that only appears when typing in the input field using reactjs, similar to the search input on the Google homepage? Check it out here: https://www.google.com import { XIcon } from '@heroicons/react/solid&ap ...

Tips for using a JavaScript variable in a PHP file on WordPress

As a newcomer to Wordpress, I am trying to navigate the Theme Editor. Within it, I found a javascript file that looks like this: const isMenuOpen = false; function toggleMenu() { alert("toggle"); isMobileMenuOpen = !isMobileMenuOpen; } ...

The Laravel Mix Hot Module Replacement (HMR) server fails to start up

Laravel Mix Version: 6.0.43 Node Version (node -v): 16.13.1 NPM Version (npm -v): 8.1.2 OS: Windows 10 21h2 Description: Encountering an issue on a fresh installation of Laravel and other existing projects. When running npm run hot, the script tag sourc ...

Applying VueJS filters to refine object values

Is there a way to verify if the value of "startAt" is present in an object and return its corresponding ID? Here is the object in question: [{ "id": "1234567", "createTimestamp": "2020", "name": { "action": "", "allDay": false, "categor ...

Preventing the Rendering of Inline-Block Whitespace in Web Browsers

Essentially, in my attempt to create a four-column layout, I have the following HTML code: <div> <div>A column</div> <div>A column</div> <div>A column</div> <div>A column</div> </div ...