I'm puzzeled with a very simple Javascript performance test.
Code for two web pages:
PAGE 1
PAGE 2Code:<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>PAGE 1</title> <script> for (var i=0; i<=1000000000; i++) { var g = i; } </script> <style> p { color: red; } </style> </head> <body> <p>Some text</p> </body> </html>
Why does the display time for the red paragraph are the same in both pages?Code:<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>PAGE 2</title> <style> p { color: red; } </style> </head> <body> <p>Some text</p> <script> for (var i=0; i<=1000000000; i++) { var g = i; } </script> </body> </html>
Shouldn't PAGE 2 display the red paragraph faster?



Reply With Quote


). How this behaves depends on the browser as well I believe.

Bookmarks