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

136
Views
How can adding a variable be faster than adding a constant?

Changing t=t+j (outher loop variable) to t=t+9 inside two nested for loops increased runtime more than 10%. How this can be possible?

for(int j=-1048576;j<1048576;j+=2000)
  for(int i=-1048576;i<1048576;i++)
    t+=9;//t+=j

CPU:Celeron N3350

I look at assembly of both binaries. Only difference I notice:

t=t+9 :
    addl $9, -4(%rbp)

t=t+j :
    movl -8(%rbp), %eax
    addl %eax, -4(%rbp)
over 4 years ago · Santiago Trujillo
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!