Lazarus and Kylix GUI performance. lazarus / 31-LCL ---------------------------------------------------------------------- toplek · 2016-01-25 19:37 Hello, I moved project from Kylix to Lazarus. The application compiled in Lazarus is working much more slowly than in Kylix: - Slow StringGrid repaint, - Slow Showing Forms, - etc. if anyone has an idea what is the reason ? Lazarus version : 1.4.4 LCL : gtk2 OS: Debian 8.2 br. PP ---------------------------------------------------------------------- mica · 2016-01-25 22:04 Try a new sample project with Lazarus and GTK/QT or try some of the examples. Are they slow too? ---------------------------------------------------------------------- Carver413 · 2016-01-25 23:56 kylix uses qt https://en.wikipedia.org/wiki/Kylix_%28software%29 ---------------------------------------------------------------------- mica · 2016-01-26 05:49 Quote from: Carver413 on January 26, 2016, 12:56:57 amkylix uses qt https://en.wikipedia.org/wiki/Kylix_%28software%29 sure, but an ancient Version. Try to install Kylix on a up to date Distro and you´ ll see the problems. ---------------------------------------------------------------------- Leledumbo · 2016-01-26 07:46 I use both gtk2/qt here (Manjaro Linux 15.12 update 4 on top of kernel 4.4), they're fine and fast. Without looking at your code, I can't see what went wrong. There might be changes required when switching from Kylix due to differences in programming philosophy (such as suppress repaint during update of GUI control). ---------------------------------------------------------------------- Graeme · 2016-01-26 10:20 Quote from: mica on January 26, 2016, 06:49:33 amsure, but an ancient Version. Kylix uses Qt 2.3 as standard, but companies like ScooterSoftware (creators of BeyondCompare) used Kylix to produce Qt 3 applications. I still have Kylix produced binaries here, and they run 100% fine on FreeBSD (with Linux compatibility layer enabled). QuoteTry to install Kylix on a up to date Distro and you´ ll see the problems. Please don't confuse the Kylix IDE with Kylix produced applications. It is ONLY the Kylix IDE that is problematic to install (not impossible) on modern Linux distros. The applications produced with Kylix has no problem running on modern Linux distro though. People that still need Kylix often install Kylix in a Red Hat 9.0 VM simply to develop the software. But the software itself runs fine everywhere on modern distros. Until recently, I still did this myself. As for the original poster's problem with Lazarus. FPC indeed produces slower binaries than Kylix (this has been proven over and over), but normally such speed differences are only visible in speed tests, not in general applications. So there might be a localised Lazarus issue on the original poster's system. Unfortunately I'm not sure what that could be though. As somebody else suggested, run some of the examples included with Lazarus - how do they perform? How does Lazarus IDE itself perform? ---------------------------------------------------------------------- toplek · 2016-01-27 13:31 Thank you for answers. 1. The software is compiled on Debian 8.2 VirtualMachine, so the Lazarus IDE itself perform as on VM, the compiled software is running on the LTSP Thin clients (HP T5730 1Ghz / 1GB RAM). 2. I made a test on the sample project: - The project: /Lazarus / 1.4.4 / examples / canvas_test / - Button "Show Draw Dialog button" - After pressing a button the TForm draws for about 1 second. 3. I changed "LCL widget type" to Qt4 and the application is even slower as on gtk2, and it even start itself 3 times slower. 4. LTSP Server is built on the hardware: Intel Pentium III processor at 1GHz x 2 / 1.5GB of RAM. 5. Hardware on the LTSP server is quite old, I have made second server with faster hardware XEON X5450 3.0Ghz / 16GB RAM. On faster machine and gtk2 the program began to operate almost normally but on qt4 continues to run very slowly. On fast hardware can hardly see the speed difference in an application compiled (gtk2) on Kylix and Lazarus, but on the slow hardware there is a big speed difference visible on ordinary windows forms, the Kylix is much more faster. What do you think about that, do you have ideas how to make the FPC produce faster binaries ? Leledumbo what you mean by writing: dry as suppress repaint during the update of the GUI control. ---------------------------------------------------------------------- mig-31 · 2016-01-27 13:54 I think different is between qt3 and qt4 widgetset. Qt3 probably faster then qt4. For better speed comparison between gtk2 and qt4, you should test gtk2 speed under Gnome and qt4 under KDE desktop. Today it difficult to test speed on Pentium 3 CPU. Most users don't have this old hardware. I have PC with old Celeron CPU 2Ghz (like Pentium 4) with 1GB of RAM and I don't see any speed difference between qt4 and gtk2. ---------------------------------------------------------------------- Graeme · 2016-01-27 17:53 Quote from: toplek on January 27, 2016, 02:31:11 pmWhat do you think about that, do you have ideas how to make the FPC produce faster binaries ? What compiler options are you using when building an executable? eg: -O3 -XX -Xs  etc? Make sure the -g compiler options are not specified. ---------------------------------------------------------------------- Graeme · 2016-01-27 17:54 Quote from: mig-31 on January 27, 2016, 02:54:30 pmFor better speed comparison between gtk2 and qt4, you should test gtk2 speed under Gnome and qt4 under KDE desktop. That will make NO difference. GTK2 and Qt4 are libraries used by LCL, and LCL talks directly to those libraries, not via Gnome or KDE. ---------------------------------------------------------------------- mica · 2016-01-27 18:22 Strange http://forum.lazarus.freepascal.org/index.php/topic,15223.msg86658.htm l#msg86658 But ok, the "heavyweight" widgetsets  are a bit sluggy on weak hardware. On Raspberry is Qt/GTK ok, but not snappy. MSEGUI/FPGUI are better/faster on weak hardware if you dont need special Lazarus features. GTK/QT with framebuffer could be an alternative, but both ist not possible with Lazarus. ---------------------------------------------------------------------- Thaddy · 2016-01-27 19:10 Quote from: mica on January 27, 2016, 07:22:40 pmGTK/QT with framebuffer could be an alternative, but both ist not possible with Lazarus. That's bollocks. Both GTK and Qt will use the framebuffer when selected or available. Lazarus simply interfaces with either of them so will automatically use framebuffer support when GTK or Qt uses it. (Or even the underlying X windows system when appropriate will use it) Problem is older video drivers and older linux kernels (it's a kernel feature nowadays)  don't have frame buffer support. So it is wrong to write that it is a Lazarus issue: it isn't. Maybe for custom drawn widgets fbdev should/can be implemented though, but GTK and Qt already use it. https://en.wikipedia.org/wiki/Linux_framebuffer ---------------------------------------------------------------------- zeljko · 2016-01-27 21:50 Quote from: toplek on January 27, 2016, 02:31:11 pmThank you for answers. 1. The software is compiled on Debian 8.2 VirtualMachine, so the Lazarus IDE itself perform as on VM, the compiled software is running on the LTSP Thin clients (HP T5730 1Ghz / 1GB RAM). 2. I made a test on the sample project: - The project: /Lazarus / 1.4.4 / examples / canvas_test / - Button "Show Draw Dialog button" - After pressing a button the TForm draws for about 1 second. 3. I changed "LCL widget type" to Qt4 and the application is even slower as on gtk2, and it even start itself 3 times slower. 4. LTSP Server is built on the hardware: Intel Pentium III processor at 1GHz x 2 / 1.5GB of RAM. 5. Hardware on the LTSP server is quite old, I have made second server with faster hardware XEON X5450 3.0Ghz / 16GB RAM. On faster machine and gtk2 the program began to operate almost normally but on qt4 continues to run very slowly. On fast hardware can hardly see the speed difference in an application compiled (gtk2) on Kylix and Lazarus, but on the slow hardware there is a big speed difference visible on ordinary windows forms, the Kylix is much more faster. What do you think about that, do you have ideas how to make the FPC produce faster binaries ? Leledumbo what you mean by writing: dry as suppress repaint during the update of the GUI control. That tests works instantly here on Celeron 1.6 with 1 GB ram (sorry, have not anything older than that) - lazarus trunk 1.7, fpc-2.6.4, Qt-4.8.6 32 bit, Fedora 12 ---------------------------------------------------------------------- mig-31 · 2016-01-28 09:32 Quote from: Graeme on January 27, 2016, 06:54:33 pmQuote from: mig-31 on January 27, 2016, 02:54:30 pmFor better speed comparison between gtk2 and qt4, you should test gtk2 speed under Gnome and qt4 under KDE desktop. That will make NO difference. GTK2 and Qt4 are libraries used by LCL, and LCL talks directly to those libraries, not via Gnome or KDE. I said bad what I meant.  It about desktop settings GNOME and KDE.  There is an example. KDE desktop with gtk-qt theme engine package. You can set a qt widget theme for gtk+ application in KDE desktop setting.  I occured, when I run pidgin (GTK+) software with this KDE setting, it draw windows slowly. Probably, it should be the same when you compile your application with gtk widget set and run it on KDE desktop with gtk-qt theme engine package. ---------------------------------------------------------------------- mica · 2016-01-28 18:00 Quote from: Thaddy on January 27, 2016, 08:10:53 pmQuote from: mica on January 27, 2016, 07:22:40 pmGTK/QT with framebuffer could be an alternative, but both ist not possible with Lazarus. That's bollocks. Both GTK and Qt will use the framebuffer when selected or available. ok tho Framebuffer is the easy way to go for the threadopener for more performance on weak hardware. ---------------------------------------------------------------------- toplek · 2016-02-05 11:32 Conclusion for slower activity in the qt4, were wrong, I changed LCL Widget for IDE but not for the compiler. After the change LCL Widget to qt4 for compiler, can not see the difference of speed between showing windows in gtk2 and qt4. I run the program on a Terminal HP t5730 Thin Client LTSP, so this server performs calculation for the program. It is now on the server processor Xeon 3GHz x 2, and anyway program compiled under Lazarus display window slower than the Kylixie compiled application even running on weake LTSP Thin Client / Server. The file size of program compiled in Kylix is 5.6 MB including 12 dependencies: 0. Application => 282kB 1. linux-gate.so.1 2. bplvisualclx.so.6.9 => 1789kB 3. bplrtl.so.6.9 => 747kB 4. libdl.so.2 => 274kB 5. libpthread.so.0 => 128KB 6. libc.so.6 => 186KB 7. libX11.so.6 => 1352KB 8. libz.so.1 =>  866KB 9. ld-linux.so.2 => 132KB 10. libxcb.so.1 => 146KB 11. libXau.so.6 => 10KB 12. libXdmcp.so.6 => 20K The file size of the same program compiled in Lazarus is 15,2MB including 49 dependencies: 0. Application : 6863kB 1. linux-gate.so.1 2. libpthread.so.0 => 78kB 3. libdl.so.2 =>  274kB 4. libX11.so.6 => 1352kB 5. libgdk_pixbuf-2.0.so.0 => 155kB 6. libgtk-x11-2.0.so.0 => 5081kB 7. libgdk-x11-2.0.so.0 => 773kB 8. libgobject-2.0.so.0 => 370kB 9. libglib-2.0.so.0 => 96kB 10. libgthread-2.0.so.0 =>  6kB 11. libgmodule-2.0.so.0 => 14kB 12. libpango-1.0.so.0 => 327kB 13. libcairo.so.2 => 1308kB 14. libatk-1.0.so.0 => 155kB 15. libc.so.6 => 186kB 16. ld-linux.so.2 => 132kB 17. libxcb.so.1 => 146kB 18. libgio-2.0.so.0 => 1746kB 19. libpng12.so.0 => 174kB 20. libm.so.6 => 274kB 21. libpangocairo-1.0.so.0 =>  50kB 22. libXcomposite.so.1 => 10kB 23. libXdamage.so.1 => 10kB 24. libXfixes.so.3 => 22kB 25. libpangoft2-1.0.so.0 =>  91kB 26. libfontconfig.so.1 => 258kB 27. libfreetype.so.6 => 707kB 28. libXrender.so.1 => 42kB 29. libXinerama.so.1 => 10kB 30. libXi.so.6 => 70kB 31. libXrandr.so.2 => 42kB 32. libXcursor.so.1 =>  42kB 33. libXext.so.6 => 79kB 34. libffi.so.6 => 26kB 35. libpcre.so.3 => 10kB 36. libthai.so.0 => 40kB 37. libpixman-1.so.0 => 734kB 38. libxcb-shm.so.0 => 10kB 39. libxcb-render.so.0 => 38kB 40. libz.so.1 => 110kB 41. librt.so.1 => 30kB 42. libXau.so.6 => 10kB 43. libXdmcp.so.6 => 20kB 44. libselinux.so.1 => 151kB 45. libresolv.so.2 => 78kB 46. libharfbuzz.so.0 => 371kB 47. libexpat.so.1 => 166kB 48. libdatrie.so.1 => 30kB 49. libgraphite2.so.3 => 106kB The same program compiled under Lazarus takes nearly 10 MB more than the same program compiled in the Kylix, maybe this is the reason why the same program runs slower on the terminal, what do you think ? How to turn on the 'FrameBuffer' in application ?, is it by 'DoubleBuffered := True;' ? PP. ---------------------------------------------------------------------- zeljko · 2016-02-05 11:46 1.Kylix uses statically linked libborqt library, supports only i386, uses commercial dcc compiler... 2.Lazarus & fpc are open source projects, and useable on dozen platforms, so there's big chance that binary size will be bigger than in case of kylix. btw have you stripped final linux binary ? 3.Double buffered is not frame buffer (if we are talking about same frame buffer). ---------------------------------------------------------------------- marcov · 2016-02-05 12:05 And check the dependencies of the Kylix libraries bpl*, or build without packages. Those files (and any Kylix specific libraries they depend on) should be added to the Kylix filesize.