Ticket #2874 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

toFloat hell

Reported by: erilem Owned by:
Priority: major Milestone: 3.0 Release
Component: BaseTypes Version: 2.10
Keywords: Cc:
State:

Description

As now known toFloat represents a pretty high percentage of execution time when panning the map.

toFloat is used in two classes only: LonLat and Bounds. In LonLat it's used in the constructor, and in add. In Bounds it's used in the constructor, and in contains.

FireBug's profile tool reports that toFloat represents ~10% of execution time when panning the map.

I did some experiments, removing toFloat calls and doing profiles. The results:

  • when removing toFloat from LonLat:init then toFloat == ~7%
  • when also removing toFloat from LonLat:add then toFloat == ~7% (no effect)
  • when also removing toFloat from the Bounds:init then toFloat == ~2%
  • and when also removing toFloat Bounds:contains method then toFloat == 0%

This suggests that we'd better not call toFloat from LonLat and Bounds, and make LonLat and Bounds users responsible for providing floats.

Change History

Changed 3 years ago by pgiraud

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

See #2875.

Note: See TracTickets for help on using tickets.