Reduce your 4D apps’ size with these new features

In our ongoing effort to improve the building of 4D applications, we’ve added a few functionalities to 4D v19R5 that you’ll certainly find useful.

The first one is the ability to remove some of the biggest 4D modules from your applications: CEF, Mecab, PHP, Spell Checker, and 4D Updater. If you don’t need some of these modules, you’ll be able to significantly reduce the size of your applications.

We also changed the final directory when you build a compiled structure, in order to accommodate those using multiple compiled versions of the same structure.

As for our Japanese customers, we have merged the Japanese version of 4D and the international one on MacOS.

Let’s delve into the details.

Removing Modules

Let’s start with the first novelty, the ability to remove modules your application doesn’t use. Now, in the plugin & components tab of the build application screen, you’ll be able to remove 5 modules:

  • CEF stands for Chromium Embedded Framework. We use it to display web areas and 4D View Pro areas. So it’s quite a useful framework, but it is also a heavy one.
  • MeCab is a 4D text formatter for the Japanese language. If your application is not localized in Japanese, you won’t need this module.
  • If you don’t use PHP, you can remove the PHP module without a second thought.
  • SpellChecker is useful if you use the spell-checking commands of 4D; otherwise, you can remove it from your application.
  • And finally, if you don’t plan on using a 4D updater to update your application, you don’t need to include it.

 

Here’s the size of all these modules on Mac and Windows:

Module Mac Windows
 CEF 459 MB 217 MB
 MeCab 80 MB 75 MB
 PHP 26 MB 19 MB
 Spell Checker 10 MB 10 MB
 Updater 11 MB 6 MB
 Maximal gain 586 MB 327 MP

As you can see, removing these modules should reduce your application size significantly, especially on Mac, as all these modules are universal binaries for Intel and Silicon architectures.
One important thing to note is that 4D won’t check your methods and forms for any call to the modules you are removing. So be certain of what you do when you uncheck one of them.

Japanese Version

Before v19R5, we provided our Japanese customers with a special version of 4D on Mac, as they were the only ones to use MeCab. Now that it can be removed from applications easily, MeCab will be included for everyone, and we will no more provide a special Japanese version of 4D.

Output Directory when compiling a structure without related folders

Finally, we have changed the output directory when you compile a structure without related folders.

The compiled structure was put directly in the Compiled Database folder of your build directory in previous versions, but it creates issues if you want to build multiple versions of the same structure. Starting with v19R5, it will be inside a folder with your application name inside the Compiled Database folder. If you have an automated build process, be careful about this change.

These new changes should help you build lighter applications and have an easier time automating your building process. And as usual, if you have any questions, drop us a comment on the 4D forum.

Nicolas Brachfogel
• Product Owner & Senior Developer • Nicolas Brachfogel joined 4D in 2017 as a Senior Developer (4D Server and networking). As Product Owner to manage the release of Apple Silicon, he's in charge of writing user stories and translating them into functional specifications, as well as making sure that feature implementations meet customer needs. A graduate of the Institut Supérieur d'Informatique Appliquée (INSIA), Nicolas began his career as a software developer in 2001. Following several years coding in Java and C++, he went on to specialize in client-server development for video game companies. As a server developer/architect, he successfully worked on the server architectures of many games (Dofus Arena, Drakerz, Trivial Pursuit Go!).