I’ve been working on a SNAP pipeline in Python and noticed the performance was way worse than in the GUI.
By saving and reloading the product after every operation (which is counter intuitive to fast code), the pipeline went from taking 3 hours to 15 minutes.
Moreover, running the process in a thread caused problems, such as file locks not properly released in memory while the files are usable by other programs with no issues.
P.S.: The forum doesn’t let me upload a Python script. I had to change the extension.
Edit: I built an equivalent graph in the SNAP GUI and the processing time was about 21 minutes. So the issue seems to be more fundamental than the SNAPPY interface.
After digging around, this seems to be closely related to this post, for which there is a JIRA open with critical priority for over a year with no updates.
Glad I’m not the only one seeing this. It’s wild that saving and reloading the product actually speeds things up, but I’ve noticed the same bottleneck with memory not being released properly in Python. It feels like the JNI/jpy bridge just struggles with the garbage collection compared to the Java GUI.