Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
faster javascript loader pixel count

I was trying to simulate canvas with only div tags with 1 pixel each - so i set divs in nodes, and it make me fill sad! Why we have 2.073.600 pixels controled by computer all the time and if we set it to div control its eats too much memory and be so slow? Its just a full hd page...

function loadskecth(){

var totalblocksX = 1920
var totalblocksY = 1080

        for(var addedblocksY = 0 ; addedblocksY < totalblocksY; addedblocksY++){

            let blocklineY = document.createElement("article");
                blocklineY.style.display        = "flex"
                blocklineY.style.flexDirection  = "row"

                for(var addedblocksX = 0 ; addedblocksX < totalblocksX; addedblocksX++){
                    
                    let blocklineX = document.createElement("article");
                    
                    let block     = document.createElement("div")
                        block.style.backgroundColor = "black"
                        block.style.height       = "1px"
                        block.style.width        = "1px"

                        block.onmouseover        = function(){block.style.backgroundColor = "orange"}

                        blocklineX.append(block)
                        blocklineY.append(blocklineX)
                }
                addedblocksX = 0
        scketch.append(blocklineY)
        }
    
    document.body.append(scketch)
}

loadskecth()

var blocksizeX = 200 var blocksizeY = 200

var blocklineX = 200 var blocklineY = 200

var addedblocksY = 0

document.body.style.margin = "0px"

any ideas to be more fast? any questions?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!