legendary icon indicating copy to clipboard operation
legendary copied to clipboard

Legendary slowness on macOS precompiled binary

Open vapidinfinity opened this issue 2 years ago • 7 comments

Platform

Operating system and version: macOS 14 | beta 2 Legendary version (legendary -V): 20.33, Undue Alarm

Expected Behavior

After typing a command into the terminal, the expected response should take milliseconds.

Current Behavior

legendary status --offline takes 6 seconds to return an output. it's even longer when trying to launch a game (< 30s)

Steps to Reproduce

  1. use legendary on macos

Additional information

vapidinfinity avatar Jul 12 '23 15:07 vapidinfinity

This issue is still present. On the pip-installed and compiled version of legendary, it's responsive as a cli should be. But on the universal macos legendary binary, it's much slower for some reason and takes a long time to return outputs for commands or even to just execute them to begin with.

vapidinfinity avatar Sep 19 '23 15:09 vapidinfinity

This is largely due to PyInstaller just being not all that great for CLI apps (on Windows/Linux it does better, on macOS it's really slow for some reason). Perhaps using https://github.com/indygreg/PyOxidizer will help there, I plan to investigate that in the future.

Also worth noting that current macOS builds should not be universal, they are x86 only.

derrod avatar Sep 19 '23 17:09 derrod

hmm what do you normally do to generate a pyinstaller binary of legendary? i might dig deeper becuase i want to integrate it into an epic launcher ui im making

vapidinfinity avatar Sep 21 '23 14:09 vapidinfinity

macOS binaries are currently created on CI, see https://github.com/derrod/legendary/blob/master/.github/workflows/python.yml

derrod avatar Sep 21 '23 15:09 derrod

k I did some further investigation and apparently it has something to do with pyinstaller's bootloader when "--onefile" is specified as a command.

It's slow because it has to unpack the libraries "just-in-time", instead of fully compiling it beforehand. using onedir rectifies the problem but makes portability a bit more of a challenge see https://stackoverflow.com/questions/9469932/app-created-with-pyinstaller-has-a-slow-startup

vapidinfinity avatar Sep 22 '23 01:09 vapidinfinity

tldr: it's slow because it has to do an extra step before running

vapidinfinity avatar Sep 26 '23 09:09 vapidinfinity

Any way to install legendary without this really slow startup time from "one file" mode? Edit: installing the python package via pip/pipx as shown in the README helps a LOT

kotx avatar May 10 '24 00:05 kotx