Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue running gdal_translate #23

Open
okhoma opened this issue Nov 22, 2019 · 1 comment
Open

Performance issue running gdal_translate #23

okhoma opened this issue Nov 22, 2019 · 1 comment

Comments

@okhoma
Copy link

okhoma commented Nov 22, 2019

The issue that I discovered is that when I run gdal_translate() multiple times in the loop, I see that about half of the time is spent in gdal_setinstallation() method. Despite the fact that I explicitly call gdal_setinstallation() on the beginning of my script.

image

I think that the problem may be caused by the following code, when gdal_installation() is called no matter if gdalUtils_gdalPath variable was set or not (line 539 of gdal_setInstallation.R):

       if(is.null(getOption("gdalUtils_gdalPath")))
       {
              rescan=TRUE  
       }
       gdal_installation_out <- gdal_installation(search_path=search_path,rescan=rescan,ignore.full_scan=ignore.full_scan,
                     verbose=verbose)
       options(gdalUtils_gdalPath=gdal_installation_out)
       if(is.null(getOption("gdalUtils_gdalPath")))
       {
       ...
       }

I believe, calculation of gdal_installation_out should go into the first brackets like follows:

       if(is.null(getOption("gdalUtils_gdalPath")))
       {
              rescan=TRUE  
              gdal_installation_out <- gdal_installation(search_path=search_path,rescan=rescan,ignore.full_scan=ignore.full_scan,
                            verbose=verbose)
              options(gdalUtils_gdalPath=gdal_installation_out)
       }
       if(is.null(getOption("gdalUtils_gdalPath")))
       {
       ...
       }

This way we will not spend time recalculating and resetting gdalUtils_gdalPath when we have it already set. It should save us almost 50% of processing time!

@jgrn307
Copy link
Contributor

jgrn307 commented Nov 22, 2019

Can you check to see if the latest version fixed it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants