Opened 13 years ago
Closed 7 years ago
#1575 closed enhancement (fixed)
r.horizon bugfix and speedup
Reported by: | sprice | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.4.0 |
Component: | Raster | Version: | svn-trunk |
Keywords: | r.horizon | Cc: | |
CPU: | All | Platform: | All |
Description (last modified by )
I mentioned this on the mailing list, but didn't get a response. So here's a more official report:
I made some tweaks to r.horizon/main.c to almost half its runtime and remove a bug. By my tests, it's output is identical to before, but a 219 minute run has been reduced to 110 minutes. Mostly due to removal of unneeded floor() calls. I could use some people to test and make sure I'm not introducing any bugs, though. Thanks, Seth
Attachments (2)
Change History (12)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Component: | Default → Raster |
---|---|
Description: | modified (diff) |
Keywords: | r.horizon added |
Platform: | Unspecified → All |
comment:3 by , 12 years ago
CPU: | OSX/Intel → All |
---|
I have manually merged the inline diff line by line (gngn) and made it an attachment.
comment:4 by , 12 years ago
Hi,
C Q: is declaring variables mid-function (say at the start of an if(){} statement) fully portable to all the platforms/compilers that we wish to support? how about declaring and initializing variables at the same time? +/-'s?
does the /100 -> *0.01 remove the expensive divide op, or is it just about removing the cumulative number of ops?
is declaring a new variable relatively inexpensive vs declaring it then using it?
which part of the patch specifically is the bug?
(as concerned with readability/maintainability as I am with speed; w/ code comments where appropriate we can have the best of both worlds; the "Code folded into the 'if' statement:" explanation is great tx)
thanks, educational-mode non-comp.sci. major Hamish
ps- in general I think we can gain a huge amount from running various bits of grass through a profiler. the "Bugs" wiki page has some suggestions, the yes,still-free-for-non-commercial/research-use Intel C compiler has a very good profiler+tutorial too. thanks Seth!
comment:5 by , 12 years ago
As far as I know, declaring variables in the if(){} is portable. I'm not sure what the speed advantage is, though. I like to explicitly give the compiler the opportunity to optimize, though.
The *0.01 is to remove the divide op.
I'm not sure where the bug is. It's been a while.
comment:6 by , 10 years ago
Probably a thorough test of current and proposed r.horizon
is needed before somebody will change the existing implementation. Please see: http://grass.osgeo.org/grass71/manuals/libpython/gunittest_testing.html
comment:7 by , 9 years ago
Milestone: | 7.0.0 → 7.0.5 |
---|
comment:8 by , 8 years ago
Milestone: | 7.0.5 → 7.3.0 |
---|
Well let's try that patch again...