Difference between revisions of "Lazarus Faq/ar"

From Free Pascal wiki
Jump to navigationJump to search
(New page: ===لماذا يكون حجم الملف التنفيذي الناتج كبير ?=== تكون الملفات التنفيذية كبيرة لاحتوائها علي معلومات الت...)
 
(categories)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===لماذا يكون حجم الملف التنفيذي الناتج كبير ?===
+
{{Lazarus Faq}}
 +
 
 +
<div dir="rtl" style="text-align: right;">
 +
===لماذا يكون حجم الملف التنفيذي الناتج كبير ؟ ===
  
 
تكون الملفات التنفيذية كبيرة لاحتوائها علي معلومات التنقيح  (debug information) واللازمة لعمل (gdb  منقح جنو ).
 
تكون الملفات التنفيذية كبيرة لاحتوائها علي معلومات التنقيح  (debug information) واللازمة لعمل (gdb  منقح جنو ).
Line 30: Line 33:
  
  
It's also important to note that the hello world lazarus software already includes a huge amount of features. It includes:
+
من المهم أيضا أن تلاحظ أن برنامج "مرحبا بالعالم " في Lazarus يحتوي علي مزايا كثيرة .فهو يتضمن :
 +
 
 +
* مكتبة لمعالجة ملفات xml
 +
 
 +
* مكتبة لمعالجة ملفات الصور من نوع  png,xpm,bmb  و ico
 +
 
 +
* تقريبا كل الويدجات من مكتبة مكونات لازاروس  (Lazarus Component Libirary  LCL)
 +
 
 +
* كل مكتبات التشغيل الخاصة بـ Free Pascal
 +
 
 +
لذا لزم أن يكون كبير الحجم ولكنه بذلك يحتوي علي كل شئ بحتاجه أي برنامج حقيقي لكي يعمل .
 +
 
  
* XML handling library
+
حجم الملف التنفيذي الناتج من lazarus يبدأ كبير , ولكنه ينمو ببطء شديد وذلك  بسبب مفسر  free pascal والطريقة اللتي تعمل بها فورمات lazarus .
* Image handling library for png, xpm, bmp and ico files
 
* Almost all widgets from the Lazarus Component Library
 
* All of the Free Pascal Runtime Library
 
  
So it's very big, but it already includes almost everything a real world non-trivial app will need.
+
علي سبيل المثال لو نظرنا إلي تطبيق مكتوب بـ C++ يبدأ ضغير جدا في برنامج "مرحبا بالعالم "  ولكنه يبدأ بالنمو بشكل سريع عندما تبدأ في إضافة خواص متقدمة له .
  
Lazarus executable size starts big, but grows very slowly, because of the Free Pascal compiler and the way lazarus forms operate. A c++ project (just an example, but applies to other languages / tools too) starts very small on the hello world, but quickly grows exponentially when you need features to write a non-trivial application.
 
  
 
[[Image:Lazarus_vs_cpp.png]]
 
[[Image:Lazarus_vs_cpp.png]]
  
  
'''Quick guide to Lazarus/FPC application size reduction''' ''(tested with Lazarus 0.9.26)''
+
'''دليل  سريع لكيفية تقليص حجم تطبيق  Lazarus/FPC''' ''(أختبر علي اﻷصدار 0.926 من Lazarus)''
 +
 
 +
 
  
 
* 1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
 
* 1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
Line 51: Line 63:
 
* 3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked
 
* 3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked
  
The most important items seem to be 2. For a simple application the executable size should now be 1-3 MB instead of 15-20 MB. At this point you can also try: Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked (Warning: this might decrease performance)
+
وعلي ما يبدو أن أهم عنصر في الخطوات السابقة هو رقم 2 .لتطبيق بسيط يصبح الحجم من 1 الي 3 ميجا بدلا من 15 -20 ميجا .
 +
هنا يمكنك أيضا تجربة
 +
 
 +
Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked  
 +
 
 +
(ولكن أحذر فهذا قد يقلل اﻵداء)
 +
 
 +
 
  
 
* 4. (Optional) Run UPX <your_executable> to compress your binary by an additional factor of 2-3 (Warning: as indicated above, there are drawbacks to using UPX).
 
* 4. (Optional) Run UPX <your_executable> to compress your binary by an additional factor of 2-3 (Warning: as indicated above, there are drawbacks to using UPX).
Line 153: Line 172:
 
</TR>
 
</TR>
 
</TABLE>
 
</TABLE>
 +
</div>
 +
 +
 +
{{AutoCategory}}
 +
[[Category:Lazarus/ar]]
 +
[[Category:FAQs/ar]]

Latest revision as of 20:45, 6 June 2015

العربية (ar) Deutsch (de) English (en) español (es) français (fr) magyar (hu) italiano (it) 日本語 (ja) 한국어 (ko) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

لماذا يكون حجم الملف التنفيذي الناتج كبير ؟

تكون الملفات التنفيذية كبيرة لاحتوائها علي معلومات التنقيح (debug information) واللازمة لعمل (gdb منقح جنو ).

المفسر يحتوي علي خيار لأزالة هذه المعلومات من الملف التنفيذي (-Xs),ولكن نظرا لوجود علة في المفسر (الاصدار 2.0.2 وما قبله ),فإنه لا يعمل جيدا . تم إصلاح هذه العلة بدءا من الاصدار 2.0.4 من المفسر.

كذلك يمكنك أستخدام برنامج strip لأزالة معلومات التنقيح من الملف التنفيذي . وتجده عادة في المسار

lazarus/pp/bin/i386-win32/.

كل ما عليك هو تنفيذ اﻷمر

strip --strip-all <your executable file with path>

إذا أردت تصغير حجم البرنامج أكثر عليك تجربة UPX أيضا .UPX أداة رائعة لضغط الملفات التنفيذية ,كما أنه سريع في عملية فك الضغط (حوالي 10 ميجا بايت في الثانية علي معالج بنتيوم 133)

فقط عليك تنفيذ اﻷمر

upx <your executable file with path>

بعد أستخدامك لهاتين الوسيلتين للضغط سيصبح برنامج بواجهة رسومية بسيط في لازاروس بمساحة

  • حوالي 700 كيلو بايت في أنظمة لينوكس .
  • حوالي 420 كيلوبايت علي أنظمة ويندوز .


مزيد من التفاصيل عن أستخدام UPX تجدها في Size Matters


من المهم أيضا أن تلاحظ أن برنامج "مرحبا بالعالم " في Lazarus يحتوي علي مزايا كثيرة .فهو يتضمن :

  • مكتبة لمعالجة ملفات xml
  • مكتبة لمعالجة ملفات الصور من نوع png,xpm,bmb و ico
  • تقريبا كل الويدجات من مكتبة مكونات لازاروس (Lazarus Component Libirary LCL)
  • كل مكتبات التشغيل الخاصة بـ Free Pascal

لذا لزم أن يكون كبير الحجم ولكنه بذلك يحتوي علي كل شئ بحتاجه أي برنامج حقيقي لكي يعمل .


حجم الملف التنفيذي الناتج من lazarus يبدأ كبير , ولكنه ينمو ببطء شديد وذلك بسبب مفسر free pascal والطريقة اللتي تعمل بها فورمات lazarus .

علي سبيل المثال لو نظرنا إلي تطبيق مكتوب بـ C++ يبدأ ضغير جدا في برنامج "مرحبا بالعالم " ولكنه يبدأ بالنمو بشكل سريع عندما تبدأ في إضافة خواص متقدمة له .


Lazarus vs cpp.png


دليل سريع لكيفية تقليص حجم تطبيق Lazarus/FPC (أختبر علي اﻷصدار 0.926 من Lazarus)


  • 1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked
  • 2. Project|Compiler Options|Linking|Debugging| Uncheck all except

Strip Symbols From Executable (-Xs) -> Checked

  • 3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked

وعلي ما يبدو أن أهم عنصر في الخطوات السابقة هو رقم 2 .لتطبيق بسيط يصبح الحجم من 1 الي 3 ميجا بدلا من 15 -20 ميجا . هنا يمكنك أيضا تجربة

Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked

(ولكن أحذر فهذا قد يقلل اﻵداء)


  • 4. (Optional) Run UPX <your_executable> to compress your binary by an additional factor of 2-3 (Warning: as indicated above, there are drawbacks to using UPX).

Chart of default sizes for an empty Application with various settings and operating systems

Well I ran tests I did on Lazarus 0.9.29 with FPC 2.4 (FPC 2.2.4 with Windows). Optimized compiler mean using the advices above but without using UPX. Default Lazarus means as installed from package/setup. LCL without debug informations mean after rebuilding Lazarus IDE and LCL without debug informations (-g-).

    Default Lazarus     LCL without debug informations
Ubuntu 64 bits / Lazarus 64 bits
Default application     13,4  Mb     7,5 Mb / 8
Optimized compiler     4,4 Mb     2,70 Mb (0.29svn FPC2.4 2,5)
   
Ubuntu 32 bits / Lazarus 32 bits
Default application     19,6  Mb     5,7 Mb
Optimized compiler     2,9 Mb     1,6 Mb
   
Windows XP 32 bits / Lazarus 32 bits
Default application     11,8 Mb     2,14 Mb
Optimized compiler     1,62 Mb     1,50 Mb
   
Windows Seven 64 bits / Lazarus 64 bits
Default application     12,3  Mb     3,20 Mb
Optimized compiler     2,14 Mb     2,16 Mb