Ticket #2998 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

delay (time consuming) grid tiles move

Reported by: pgiraud Owned by: elemoine
Priority: minor Milestone: 2.11 Release
Component: Layer.Grid Version: 2.10
Keywords: mobile Cc: courriel@…
State: Complete

Description

After a bit of profiling, we easily noticed that a large amount of time is spent in the Tile.Image::positionImage method. This method is actually called each time a tile is moved to be positioned somewhere else in the grid, ie. each Layer.Grid::moveGriddedTiles is called.

Some quick tests showed that delaying the tiles move until the map stops moving is really improving the user experience.

With the attached patch, tests continue to pass on FF3 and Chrome 9. New unit tests and a new example may need to be written.

Attachments

patch-2998-A0.diff Download (3.5 KB) - added by pgiraud 2 years ago.
patch-2998-example.diff Download (2.5 KB) - added by pgiraud 2 years ago.
example
openlayers-2998.patch Download (9.3 KB) - added by ahocevar 2 years ago.

Change History

Changed 2 years ago by pgiraud

follow-up: ↓ 2   Changed 2 years ago by ahocevar

This may be a good option until we finally find some time to rewrite the grid code so tiles no longer need to be positioned, because they use css sizing and positioning with percentages instead of pixels. This will also make it much easier to use arbitrary resolutions, regardless of availability on the server, and animated zooming.

In order to not make this endeavor more complicated, I'd only ask to not introduce new APIProperties on tile- and grid-related classes (tileLoadingDelay in this case).

Another comment on the patch: how does this play together with viewRequestID, which is used on the tiles and kept track of on the Map?

in reply to: ↑ 1   Changed 2 years ago by pgiraud

Replying to ahocevar:

This may be a good option until we finally find some time to rewrite the grid code so tiles no longer need to be positioned, because they use css sizing and positioning with percentages instead of pixels. This will also make it much easier to use arbitrary resolutions, regardless of availability on the server, and animated zooming.

I think this doesn't address the same problem since, with this enhancement, we will still call image.src = 'url_to_image' which appears to be expensive.

In order to not make this endeavor more complicated, I'd only ask to not introduce new APIProperties on tile- and grid-related classes (tileLoadingDelay in this case).

I don't really mind removing the tileLoadingDelay from API, though I still think that changing the way tiles are positioned is a completely different feature.

Another comment on the patch: how does this play together with viewRequestID, which is used on the tiles and kept track of on the Map?

This should have no impact. But it has to be confirmed.

Changed 2 years ago by pgiraud

example

  Changed 2 years ago by sbrunner

  • cc courriel@… added

  Changed 2 years ago by ahocevar

  • state changed from Needs More Work to Commit

[openlayers-2998.patch] makes the delay the default behavior, and adds a test that makes sure moveGriddedTiles is called delayed. The new patch also does not call OpenLayers.Function.bind on every moveTo cycle, and stores bounds in a _bounds variable of the instance.

Tests pass in Safari5. Please commit if you agree with my changes and can confirm that tests also pass in other relevant browsers.

Changed 2 years ago by ahocevar

  Changed 2 years ago by erilem

Tests pass in Chrome 7, FireFox 3, FireFox 4 beta, and IE7, and the fullScreen example works as expected in these browsers. Please commit.

  Changed 2 years ago by erilem

  • status changed from new to closed
  • resolution set to fixed

In with [11159].

  Changed 2 years ago by erilem

  • keywords mobile added

  Changed 2 years ago by fredj

  • state changed from Commit to Complete
Note: See TracTickets for help on using tickets.