Significantly worse performance for PyQt application in Snap vs native Python

Sorry for the late reply.

I tried LZO compression and that seemed to substantially speed up the initial start time so I’m guessing my main issue is decompressing a very large snap on the first start. LZO compression also increased the snap size from ~1GB -> ~1.2GB. This is a relatively small increase in size but I was having issues uploading a snap much larger than my current one to the Snap Store. I don’t think I’m going to switch to LZO compression just yet, and instead try to get the snap size down first, but I think it will make sense eventually.

Since my main issue seems to be fixed with LZO compression I don’t think pre-compiling my *.pyc files with an override-build is worth it for me. I still gave it a try just to see what would happen but wasn’t able to get it to work easily. I tried adding a lightly modified version of @om26er’s linked code:

override-build: |
  snapcraftctl build  
  pip3 install --ignore-installed -U --no-compile --prefix $SNAPCRAFT_PART_INSTALL .
  python3 -m compileall -b $SNAPCRAFT_PART_INSTALL
  find $SNAPCRAFT_PART_INSTALL -type f -name "*.py" -exec rm {} \;
  find $SNAPCRAFT_PART_INSTALL -type f -name "*.so" -exec strip -s {} \;

The above code gave me a permission error for the Python interpreter. I don’t understand Python packaging very well so I’m assuming I’m using @om26er’s code incorrectly and I couldn’t find other examples of people doing this. Since I don’t think I’m going to do *.pyc pre-compilation for now this shouldn’t be an issue for me but putting it here in case anyone’s curious.