Opened 10 years ago
Closed 6 years ago
#2515 closed task (invalid)
d.rast: multiple calling G_find_raster2()
Reported by: | martinl | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 7.2.4 |
Component: | Default | Version: | svn-trunk |
Keywords: | d.rast, G_find_raster | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
When rendering raster data using d.rast
the function G_find_raster2()
is called multiple times, this could be probably reduced... ???
D1/1: Cairo_Set_window: 0.000000 480.000000 0.000000 640.000000 D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster(): name=dmt mapset= D1/1: G_find_raster(): name=MASK mapset=pg D1/1: Cairo_Set_window: 0.000000 480.000000 0.000000 640.000000 D1/1: Cairo_Set_window: 0.000000 480.000000 80.000000 560.000000 D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset=PERMANENT D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset=PERMANENT D1/1: G_find_raster2(): name=dmt mapset= D1/1: G_find_raster2(): name=dmt mapset=PERMANENT D1/1: G_find_raster(): name=MASK mapset=pg
Change History (8)
comment:1 by , 10 years ago
comment:4 by , 8 years ago
Milestone: | 7.2.1 → 7.2.2 |
---|
comment:7 by , 7 years ago
Milestone: | → 7.2.4 |
---|
comment:8 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Replying to martinl:
Maybe. Although most of this isn't specific to d.rast, but applies to any module which accesses raster maps. Most lib/raster functions which take a map name as an argument end up calling G_find_raster2().
Taking d.rast as an example, setting a breakpoint on G_find_raster2() shows:
Six calls, of which one is from Rast_map_is_fp(), one from Rast_read_colors() (via Rast_map_is_fp()), and the other four from Rast_open_old().
Some of those could be eliminated. E.g. Rast_get_gdal_link() could probably skip the explicit G_find_raster2() call and move the Rast_map_type() call to after the G_fopen_old_misc() call (i.e. the check for whether the map is actually GDAL-linked).
A more general solution would be to replace the use of (name, mapset) with a map handle ("fd"). This would require opening maps earlier, but would allow information to be retrieved from the fileinfo structure. E.g. calls to Rast_map_type() could be replaced with Rast_get_map_type(), which is just: