Results 1 to 7 of 7

Thread: Max image size firefox??

  1. #1
    Join Date
    Dec 2011
    Posts
    34
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Max image size firefox??

    Google chrome runs my javascript tile engine over 200fps, safari more than 120fps, with a map size 500 tiles x 300 tiles with no limit in site! (runs same speed with 150,000 tiles as it did at 1,000 tiles)

    While firefox dies at 200x100 tiles. Actually at 200x100 it gives a popup asking to stop script or continue, if you hit continue it finishes drawing, but anymore than 200x100 and it gives a "close program to avoid data loss" error.

    The tiles are 64 pixel squares, so at 200x100 = 12800x6400px

    While Chrome+ safari runs 500x300 no problem which is 32,000x19,200px
    and it's still over 200fps.............

    So I was wondering if there's some golden rule with max image size, in situations where you have a viewport that can pan a very large image??

    The entire map is based off 9 tiles which are repeated and it's only supposed to draw what's within the viewport rather than the entire map.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    It's generally the amount of time spent in looping that's an issue. The browser doesn't know how long this is going to continue. After awhile it begins to suspect it's an endless loop. Another factor is how much CPU and memory resources the browser needs for each loop, and whether or not there are loops within loops. The browser should detect when its demands upon the CPU and memory are such that it might crash the system and either warn you, or stop without explanation. The system itself may detect the situation and issue a warning or simply inform you that the program has stopped functioning. Or the program may just crash or freeze.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    lmbarns (02-22-2012)

  4. #3
    Join Date
    Dec 2011
    Posts
    34
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    It's generally the amount of time spent in looping that's an issue. The browser doesn't know how long this is going to continue. After awhile it begins to suspect it's an endless loop. Another factor is how much CPU and memory resources the browser needs for each loop, and whether or not there are loops within loops. The browser should detect when its demands upon the CPU and memory are such that it might crash the system and either warn you, or stop without explanation. The system itself may detect the situation and issue a warning or simply inform you that the program has stopped functioning. Or the program may just crash or freeze.
    That pretty much explains it. Sadly FF seems to be different from the other browsers.

    It does loop through a couple arrays, and create a couple new arrays. It hangs at the point where it's writing an array containing "zones", the actual zone it locked up on was around 2744, 276. I wonder if the new array it's making is way bigger than the 150k entry one it's reading from, since the 150k entries are single digits.

    With the zones, it writes 9x entries for each zone (3x3 tile zones) which end up containing multiple digits in each entry (zone 2744, 276 for example is 7 digits x 9 tiles = 63 characters in 1 zone where the original array only contains 1 digit for each tile). So instead of 150k characters, it's 7x that which could be over 1million characters. (almost 2million in the 500x500 tile grid chrome and safari support )

    Chrome and safari seem to handle it differently as I tested at 500x500 tiles (250k tiles) and both ran it fine. That's an insane sized map, I just thought it would be amazing to handle even half that but 100x100 is only 10k tiles for FF, and not nearly as "epic", but still alright I suppose. I'm hoping somebody develops a plugin for the other browsers to use the v8 engine, I saw IE has a plugin, but I wasn't going to even support them at first, but they might end up better than FF if the plugin's worth anything.

    The "FF safe" version (100x100 tiles) http://simplehotkey.com/TileEngine/tiles/main.html if you're interested in seeing what I'm talking about. The basic javascript tile engine is open source I found on a blog. Click inside window then hit arrow keys to move, or drag image to pan the level like a RTS. I didn't know javascript could be so fast. Looking to make some rogue-like games with it

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Yeah, it's a real CPU hog. Are you on a Mac? If so, the webkit browser engines of both Safari and Chrome would probably give them an advantage on a Mac platform. I ran it in Opera and then in Chrome on a Win 7 system here. It had the CPU almost maxed out (high 80's percent usage) even when I wasn't moving it around. When I did move it, the CPU usage went to 99% at times in each. I was smart enough not to attempt running it in both browsers at the same time.

    Do you have a resource monitor on your computer? In Win it's Task Manager's Performance tab that shows CPU and memory usage in real time.

    If you've got something like that, run it while experimenting with the various browsers. I think that would probably confirm the diagnoses.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #5
    Join Date
    Dec 2011
    Posts
    34
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    Yeah, it's a real CPU hog. Are you on a Mac? If so, the webkit browser engines of both Safari and Chrome would probably give them an advantage on a Mac platform. I ran it in Opera and then in Chrome on a Win 7 system here. It had the CPU almost maxed out (high 80's percent usage) even when I wasn't moving it around. When I did move it, the CPU usage went to 99% at times in each. I was smart enough not to attempt running it in both browsers at the same time.

    Do you have a resource monitor on your computer? In Win it's Task Manager's Performance tab that shows CPU and memory usage in real time.

    If you've got something like that, run it while experimenting with the various browsers. I think that would probably confirm the diagnoses.
    Thanks for responding. I'm on a win 7 machine. I imagine it's probably going to max the cpu even idle because of some setinterval() functions set with an interval of 1, aren't those in milliseconds?

    I just went to the wrong url when trying to see what my phone would do and the phone actually loaded a map 500x100, which is 5x bigger than firefox can load on my desktop........which makes no sense...........it's a 2.5 year old htc t-mobile phone with android OS. It only got 4 frames per second, but I was blown away it could even load the level.....that FF couldn't........I couldn't move (no touch controller set up) to test further but I was amazed it loaded it all up and I saw the console stats stating it was the larger map, it sat there at 4 fps.

    I've had multiple browsers with multiple frames running a few different versions at the same time and it seems to only give energy to whats in focus, maybe that's wrong, but every time I tab back to a non focused window it's says 1fps and then it starts updating again...

    The phone thing blew me away though I don't understand why firefox freezes on something an older phone loaded relatively quickly(well, about a minute which is fast for that particular phone to load anything)....

    I ended up adding a doctype and even IE can load the largest map I've tried (500x500) without the chrome frame plugin(but it froze when drawing upcoming zones as you ran into new territory). Must be some quirk with FF. I at least saw Google is working on a frame plugin to run chrome's javascript engine inside FF and Safari like it now does in IE, in the near future. May fix my problem and improve performance at the same time.

  7. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    I'm a little surprised Safari Win works so well for you on this. I've been having problems with that browser in general all along the way and it has only gotten worse, seeming balky, slow to load, impossible to paste in local files to its address bar (I can drag and drop them from other browsers to the body of the browser though).

    Chrome on the other hand is very fast. My only complaint with it is it seems so minimalistic. I know it's not, but it's like they're hiding all the features.

    In any case, have you followed my suggestion? Fire up Task Manager (right click on the taskbar and choose 'Start Task Manager') and click on the Performance tab.

    Differences in browsers as regards CPU usage should become apparent.

    As for Firefox's bad behavior here, it's better with some things no doubt, obviously not this. Short of the javascript code itself, it's all about how the browser engine (especially but not only its script parser) is written and how that interfaces with the OS and hardware. This isn't the first time I've heard of Firefox "pulling more G's in a turn", if you will. It has been reported to be a memory hog as well.

    The Firefox development team has been feeling the heat lately from Chrome and IE, both of which are adding features and fixing up things fairly rapidly. IE not so much lately, they seem to have paused at version 9 for now. I'm not sure of Chrome's current development arc but they do have a very nice browser and update it automatically.

    In other words I think it's fairly well known that Firefox, though still a great browser, is no longer the obvious choice it once was. By going the add on route for its developer tools, I find it at times tripping over its own feet, finding errors in its own internal scripts and routines, and sometimes reporting errors that don't exist, all of which tends to confuse things a little when you're trying to diagnose an actual script or page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #7
    Join Date
    Dec 2011
    Posts
    34
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    I ended up finding it was my "Use hardware acceleration" setting in firefox that breaks it. If I uncheck it, it loads the larger maps. I think my video card is probably going...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •