issue131:mon_opinion
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue131:mon_opinion [2018/03/31 17:45] – créée auntiee | issue131:mon_opinion [2018/04/20 14:28] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Although compilers are at the very heart of software development, | + | **Although compilers are at the very heart of software development, |
Clang is a rather unusual C language compiler, in the sense that it is in fact only one component of the complete toolchain. The other, backend, portion is the LLVM project, that can be combined with other front-ends to provide compilers for a large variety of other programming languages. | Clang is a rather unusual C language compiler, in the sense that it is in fact only one component of the complete toolchain. The other, backend, portion is the LLVM project, that can be combined with other front-ends to provide compilers for a large variety of other programming languages. | ||
- | Clang has been used within Apple’s Mac OS, Google’s Android, and, more recently, as a main compilation system option for FreeBSD and OpenBSD. There has been a movement towards providing access to this compiler within the GNU/Linux distribution ecosystem, though few have actually made the switch from the more common GNU C Compiler (gcc) to Clang. OpenMandriva made the headlines back in 2016 for this reason. | + | Clang has been used within Apple’s Mac OS, Google’s Android, and, more recently, as a main compilation system option for FreeBSD and OpenBSD. There has been a movement towards providing access to this compiler within the GNU/Linux distribution ecosystem, though few have actually made the switch from the more common GNU C Compiler (gcc) to Clang. OpenMandriva made the headlines back in 2016 for this reason.** |
- | Since options are always a good thing, and Clang has been touted as being faster during compilation, | + | Bien que les compilateurs soient au cœur même du développement logiciel et que la vitesse et la précision de toute application rencontrée par le lecteur dépendent finalement de la qualité du compilateur utilisée pour la produire, la plupart des utilisateurs n'y pensent vraiment pas beaucoup. Il se peut que certains des connaisseurs reconnaissent l' |
+ | |||
+ | Clang est un compilateur de langage C qui est plutôt inhabituel, dans le sens où il n'est, en fait, qu'un seul composant de la chaîne complète des outils. L' | ||
+ | |||
+ | Clang a servi à l' | ||
+ | |||
+ | |||
+ | **Since options are always a good thing, and Clang has been touted as being faster during compilation, | ||
# aptitude install clang | # aptitude install clang | ||
Ligne 11: | Ligne 18: | ||
Software packages weighing in at 27.4 MBytes were downloaded and installed, and I had access to the clang command. After reading the documentation, | Software packages weighing in at 27.4 MBytes were downloaded and installed, and I had access to the clang command. After reading the documentation, | ||
- | I then decided to write a couple of short test programs to compile with both suites, and test out. My first test was a very classical table sorting routine, that compiled in 0.03 s with Gcc, and 0.05 s with Clang. Executable files were 9040 Bytes from Gcc, and 8376 Bytes with Clang. Execution times were 3.12 s with the Gcc-compiled version, and 0.004 s with the Clang-produced binary file. With my second test program, a matrix multiplication, | + | I then decided to write a couple of short test programs to compile with both suites, and test out. My first test was a very classical table sorting routine, that compiled in 0.03 s with Gcc, and 0.05 s with Clang. Executable files were 9040 Bytes from Gcc, and 8376 Bytes with Clang. Execution times were 3.12 s with the Gcc-compiled version, and 0.004 s with the Clang-produced binary file. With my second test program, a matrix multiplication, |
- | Though the test set is rather small and is very much geared toward computationally intensive applications using no libraries other than standard C routines, it is clear that both compilation suites perform well, and are quite comparable to each other. Contrary to one of the advantages set forward, compilation times with Clang were in fact a tad longer than with Gcc, though executable file sizes and execution times were best with Clang. | + | Puisque avoir des options est toujours une bonne chose et que Clang a été annoncé comme étant plus rapide pendant la compilation, |
+ | |||
+ | # aptitude install clang | ||
+ | |||
+ | Après le téléchargement et l' | ||
+ | |||
+ | Ensuite, j'ai décidé d' | ||
+ | |||
+ | **Though the test set is rather small and is very much geared toward computationally intensive applications using no libraries other than standard C routines, it is clear that both compilation suites perform well, and are quite comparable to each other. Contrary to one of the advantages set forward, compilation times with Clang were in fact a tad longer than with Gcc, though executable file sizes and execution times were best with Clang. | ||
However, most real-life applications do actually need to use external libraries present on the system. To see how Clang compared in comparison with Gcc in this use-case, I tried out a short demo program using the GTK version 3 library. Compilation is a tad more complex, since these development libraries first need to be installed: | However, most real-life applications do actually need to use external libraries present on the system. To see how Clang compared in comparison with Gcc in this use-case, I tried out a short demo program using the GTK version 3 library. Compilation is a tad more complex, since these development libraries first need to be installed: | ||
Ligne 21: | Ligne 36: | ||
Then, one needs to invoke each compiler while adding both a path for header files (actually located in directory / | Then, one needs to invoke each compiler while adding both a path for header files (actually located in directory / | ||
- | gcc `pkg-config --cflags gtk+-3.0` test_gtk.c -o test_gtk `pkg-config --libs gtk+-3.0` | + | gcc `pkg-config --cflags gtk+-3.0` test_gtk.c -o test_gtk `pkg-config --libs gtk+-3.0`** |
- | As mentioned, compiler parameters are similar and this was easily adapted for Clang: | + | Bien que le jeu de test soit plutôt petit et totalement axé sur des applications de calcul intensif avec aucune autre bibliothèque que celle des routines C standard, il est évident que les performances des deux suites de compilation sont bien et que les deux sont tout à fait comparables. Contrairement à l'un des avantages annoncés, les temps de compilation avec Clang étaient, en fait, un chouïa plus longs qu' |
+ | Toutefois, la plupart des véritables applications nécessitent l' | ||
+ | # aptitude install libgtk-3-dev | ||
+ | |||
+ | Puis, l'on doit invoquer chaque compilateur tout en ajoutant à la fois un chemin pour les fichiers d' | ||
+ | |||
+ | gcc `pkg-config --cflags gtk+-3.0` test_gtk.c -o test_gtk `pkg-config --libs gtk+-3.0` | ||
+ | |||
+ | **As mentioned, compiler parameters are similar and this was easily adapted for Clang: | ||
Ligne 32: | Ligne 55: | ||
Compilation times were 0.29 s for Gcc, and 0.54 s for Clang. This time, however, executable files weighed in at 14808 Bytes for the Gcc-compiled version, and 15440 Bytes for Clang. | Compilation times were 0.29 s for Gcc, and 0.54 s for Clang. This time, however, executable files weighed in at 14808 Bytes for the Gcc-compiled version, and 15440 Bytes for Clang. | ||
- | At the time of writing (early 2018), Clang still seems to perform less well during compilation on a Gcc-dominated system. As for executable file sizes and execution times - where applicable in background tasks - it is probably fair to say that there are no major differences in file sizes, while pure C programs with no library invocations benefit considerably from the use of Clang as regard execution times. | + | At the time of writing (early 2018), Clang still seems to perform less well during compilation on a Gcc-dominated system. As for executable file sizes and execution times - where applicable in background tasks - it is probably fair to say that there are no major differences in file sizes, while pure C programs with no library invocations benefit considerably from the use of Clang as regard execution times.** |
+ | |||
+ | Comme mentionné ci-dessus, les paramètres des compilateurs sont similaires et celui-ci fut facilement adapté pour Clang : | ||
+ | |||
+ | clang `pkg-config --cflags gtk+-3.0` test_gtk.c -o test_gtk `pkg-config --libs gtk+-3.0` | ||
+ | |||
+ | Les temps de compilation était de 0,29 sec pour GCC et de 0,54 sec pour Clang. Cependant, cette fois-ci, les fichiers exécutables faisaient 14 808 bytes pour la version compilée avec GCC et 15 440 bytes pour Clang. | ||
+ | |||
+ | Au moment où j' | ||
+ | |||
+ | **So this is a bit of a mixed result, and not yet in line with what the Clang project are aiming for (see https:// | ||
+ | |||
+ | For the time being, the fact that this compiler suite is available within Ubuntu, but also under Mac OS, several BSD distributions, | ||
- | So this is a bit of a mixed result, and not yet in line with what the Clang project are aiming for (see https:// | + | Ainsi, les résultats sont un peu ambigus et pas encore conformes aux objectifs du projet |
- | For the time being, the fact that this compiler | + | Pour l' |
issue131/mon_opinion.1522511101.txt.gz · Dernière modification : 2018/03/31 17:45 de auntiee