15

We just finished building an electron application with node and react. The application is running smooth on every platform and we are pretty happy of the result. Now we received the request to distribute a version of that app on dvd (meaning that we need to run the application directly from the disc without installing it on the local drive) so we just burn it and tried to launch it. The app is working fine but the problem is the loading time as it takes almost 2 minutes to have the app running without any feedback to the end user. This is caused by the overhead for loading a large number of files which is very slow from the optical drive. So we need some ideas to speed up things or at least to have something to show to the user during the loading time. This could be a launcher application with a splash screen but it must run on mac, win and linux. We thought at QT, but we'd like something less complicated..

Any ideas are welcome

  • Your dvd probably has problems reading the disk. dvd's are fast enough to load an application in a few seconds. Test the disk read performance – dtech Mar 26 '16 at 18:54
  • I tested it on 18 different hardware combination. The optical drive is fast when transferring large files but very slow if you need to read several small files. Even the electron sample app takes more then a minute to load from cd/dvd – Alessandro Loziobiz Bisi Mar 26 '16 at 21:15
  • 1
    If you have a high count of very small files, it might be the slow access time that's doing the damage. if possible, you should combine all fines into a single binary file, load into memory and read individual file chunks from there. – dtech Mar 26 '16 at 23:00
  • 4
    Electron supports packaging apps into asar archives. I don't know much about it, but it may help with loading times from slow storage. https://github.com/atom/electron/blob/master/docs/tutorial/application-distribution.md#packaging-your-app-into-a-file – Max Mar 27 '16 at 01:52
  • 1
    You could wrap your application using one of the numerous unzip systems and run it from an archive decompressed into a temporary location. – Kuba hasn't forgotten Monica Mar 28 '16 at 20:07
  • First of all you should run a profiler. Create version of application which can be profiled, install it on a disk and than launch it using profiler tool. After that analyze the result find the bottle neck than update this question. – Marek R May 13 '16 at 08:04
  • There are special option in MSVC compiler(or linker) to optimize loading performance in case of starting from CD / Network (some kind of force swapping flag). But it related only for windows platform. And you should rebuild Qt too with this flag. – Dmitry Sazonov May 15 '16 at 17:43
  • Btw, use a static linkage + pack your application with UPX. – Dmitry Sazonov May 15 '16 at 17:49
  • /SWAPRUN compiler option – Dmitry Sazonov May 16 '16 at 07:20
  • I assume you use minify and unify of your files? If you have only a small amount of js files, this should run faster. – Alexander_F May 23 '17 at 13:11

3 Answers3

2

Try packaging your application as an asar archive. Accessing an archive is faster than accessing multiple small files.

You may want to use electron-builder for that purpose.

Akshay Anurag
  • 724
  • 1
  • 8
  • 27
1

This is most likely not a problem with the application or device you are running it on, it is more likely to be a slow DVD Player or a slow DVD itself, it might also be useful trying to distribute via other methods, such as making an installer and letting people download from a website, or selling USBs with the executable on. Another question, have you converted your electron app from source to executables? It is much faster and easier to start executables than it is to run the electron code from a command.

reee
  • 192
  • 2
  • 2
  • 12
0

I have a theory, it might have to do with the fact that you can't write to your typical DVD, so it may not be the load time, it might be that it's trying to write, and it can't.

I did a little investigation into my theory, and downloaded some electron apps, and then started investigating their package contents (on MacOS) to see if they were modified by the OS during the install process.

Most of the files I encountered had the same creation/modified date from when the app was packaged for deployment. However, in both of these cases, I noticed that inside the Contents/Frameworks there were three directories that were modified at the time I installed the app (Electron Framework.framework, Mantle.framework, ReactiveCocoa.framework, and Squirrel Framework).

It seems that if it tried to make those updates to those files on a DVD, there'd be an error.

That's my theory - it may not be correct, but haven't heard it mentioned here, so maybe look into that.

chairmanmow
  • 649
  • 7
  • 20