<div dir="ltr">Hi Hugues,<br><br>Would you consider reviewing the attached patch to cause CS-MAP to cache NTv2 grid files fully in memory on first use? We've run into an issue where not caching these files results in a substantial performance penalty.<br>
<br>This patch is not sufficient to satisfy the RFC 5 reentrancy requirements, because grids are loaded when transforming the first point, not at initialization time.<br><br>Details of our investigation in the context of our product, FME (<a href="http://www.safe.com">www.safe.com</a>), follow below.<br>
<br>---<br><br>After upgrading to CS-Map 13.10 (r2144) from 12.02 (r1964), FME was observed to slow down by two orders of magnitude while reprojecting ~44M points involving a DHDN BeTa2007 NTv2 datum transformation.  This slowdown only occurred on Windows; Linux remained performant.<br>
<br>Profiling indicated that:<br><br>* all time was being spent within fseek/fread calls<br>* we appeared to be doing an appropriate amount of work for each point<br>* whereas previous versions of FME registered almost no disk I/O during this operation, the current FME shows massive disk I/O (as observed in Process Explorer)<br>
<br>Tweaking setvbuf cache sizes had no observable impact on performance.  Diff inspection of the upgrade did not find any changes obviously related to the degraded performance.  Extensive Google searches did not result in any recommendations of how to encourage Windows to return to its previous caching behavior.<br>
<br>Erratic performance seemingly tied to file system caching has been observed within FME before, with Japanese grids (CScalcTokyoToJgd2k).<br><br>One thing not explicitly tested that might have been interesting: Can a slowdown of similar magnitude be observed in the CS-Map testbed?  This may have indicated whether the way FME interacts with CS-Map, or the way FME is managing other resources, is a factor.<br>
<br>Testing of patch:<br><br>* Logs of the Test and TestCpp programs were collected with and without the NTv2 caching patch (random seed of '1' used in all runs).  Diffs indicate no change in behavior.<br>* FME's own testsuite did not detect behavior changes during NTv2 reprojection<br>
<br>Regards,<br><br>Paul<br><br>––––––––––––––––––––––––––––––––<br><br>Paul Nalos | Database Team Lead<br><br>Safe Software Inc.<br>T 604.501.9985 x 301<br><a href="mailto:paul.nalos@safe.com">paul.nalos@safe.com</a> | <a href="http://www.safe.com">www.safe.com</a><br>
<br>––––––––––––––––––––––––––––––––<br><div>
</div></div>