Recent

Author Topic: Compile time of resource file  (Read 688 times)

Pascal

  • Hero Member
  • *****
  • Posts: 879
Compile time of resource file
« on: March 09, 2020, 01:23:24 pm »
Why does compiling this resource unit takes more than 30 seconds? (Ryzen 9 3900X)
The resource is 8.4 MB.

Code: Pascal  [Select][+][-]
  1. unit primeRes;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. implementation
  8.  
  9. uses
  10.   LResources;
  11.  
  12. initialization
  13.  
  14. LazarusResources.Add('handbuch','PDF',[
  15.   '%PDF-1.5'#13#10'%'#181#181#181#181#13#10'1 0 obj'#13#10'<</Type/Catalog/Page'
  16.   +'s 2 0 R/Lang(de-DE) /StructTreeRoot 418 0 R/MarkInfo<</Marked true>>>>'#13
  17.   +#10'endobj'#13#10'2 0 obj'#13#10'<</Type/Pages/Count 49/Kids[ 3 0 R 10 0 R 1'
  18.   +'6 0 R 17 0 R 25 0 R 29 0 R 32 0 R 35 0 R 39 0 R 43 0 R 47 0 R 50 0 R 51 0 R'
  19.   +' 53 0 R 55 0 R 56 0 R 57 0 R 58 0 R 59 0 R 60 0 R 61 0 R 62 0 R 63 0 R 64 0'
  20.   +' R 66 0 R 68 0 R 70 0 R 71 0 R 72 0 R 73 0 R 74 0 R 77 0 R 82 0 R 85 0 R 88'
  21.   ...
  22.   +'1C323BA7AE7EC445A109053CCA4CB522>] >>'#13#10'startxref'#13#10'2125192'#13#10
  23.   +'%%EOF'#13#10'xref'#13#10'0 0'#13#10'trailer'#13#10'<</Size 1902/Root 1 0 R/'
  24.   +'Info 417 0 R/ID[<1C323BA7AE7EC445A109053CCA4CB522><1C323BA7AE7EC445A109053C'
  25.   +'CA4CB522>] /Prev 2125192/XRefStm 2120577>>'#13#10'startxref'#13#10'2163396'
  26.   +#13#10'%%EOF'
  27. ]);
  28. LazarusResources.Add('kurzanleitung','PDF',[
  29.   '%PDF-1.5'#13#10'%'#181#181#181#181#13#10'1 0 obj'#13#10'<</Type/Catalog/Page'
  30.   +'s 2 0 R/Lang(de-DE) /StructTreeRoot 106 0 R/MarkInfo<</Marked true>>>>'#13
  31.   +#10'endobj'#13#10'2 0 obj'#13#10'<</Type/Pages/Count 2/Kids[ 3 0 R 53 0 R] >'
  32.   +'>'#13#10'endobj'#13#10'3 0 obj'#13#10'<</Type/Page/Parent 2 0 R/Resources<<'
  33.   +'/Font<</F1 5 0 R/F2 9 0 R/F3 11 0 R/F4 16 0 R/F5 18 0 R/F6 42 0 R/F7 46 0 R'
  34.   ...
  35.   +'<1F824346AFB279479AF038F22AD20A7A><1F824346AFB279479AF038F22AD20A7A>] >>'#13
  36.   +#10'startxref'#13#10'483577'#13#10'%%EOF'#13#10'xref'#13#10'0 0'#13#10'trail'
  37.   +'er'#13#10'<</Size 473/Root 1 0 R/Info 105 0 R/ID[<1F824346AFB279479AF038F22'
  38.   +'AD20A7A><1F824346AFB279479AF038F22AD20A7A>] /Prev 483577/XRefStm 482310>>'
  39.   +#13#10'startxref'#13#10'493198'#13#10'%%EOF'
  40. ]);
  41.  
  42. end.
  43.  
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1909)

Cyrax

  • Hero Member
  • *****
  • Posts: 806
Re: Compile time of resource file
« Reply #1 on: March 09, 2020, 01:34:22 pm »
Why you are using old resource file format (Lazarus)? Please use FPC (native) resource file format.

https://wiki.freepascal.org/Lazarus_Resources#FPC_resources

Thaddy

  • Hero Member
  • *****
  • Posts: 10139
Re: Compile time of resource file
« Reply #2 on: March 09, 2020, 01:37:14 pm »
Why you are using old resource file format (Lazarus)? Please use FPC (native) resource file format.

https://wiki.freepascal.org/Lazarus_Resources#FPC_resources
Because the old stuff is not marked as deprecated? Which it is.
I am more like donkey than shrek

Pascal

  • Hero Member
  • *****
  • Posts: 879
Re: Compile time of resource file
« Reply #3 on: March 09, 2020, 02:12:38 pm »
Okay, i could change resource format but the question is: Why is this so slow? About one year ago i didn't notice any slow compiling of this unit.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1909)

eljo

  • Sr. Member
  • ****
  • Posts: 362
Re: Compile time of resource file
« Reply #4 on: March 09, 2020, 02:21:43 pm »
Why you are using old resource file format (Lazarus)? Please use FPC (native) resource file format.

https://wiki.freepascal.org/Lazarus_Resources#FPC_resources
because only the old stuf work as expected with the components icons in the IDE? but yea other than that you should use an .rc file

Cyrax

  • Hero Member
  • *****
  • Posts: 806
Re: Compile time of resource file
« Reply #5 on: March 09, 2020, 04:34:42 pm »
Okay, i could change resource format but the question is: Why is this so slow? About one year ago i didn't notice any slow compiling of this unit.

Probably due to changes how FPC trunk compiler handles strings and its conversions to UTF8 and back etc. Also there is a ton new shiny features added to the trunk compiler.

You might want to test if disabling $LONGSTRINGS feature (aka reference counted strings) helps.  https://www.freepascal.org/docs-html/prog/progsu25.html

PascalDragon

  • Hero Member
  • *****
  • Posts: 1542
  • Compiler Developer
Re: Compile time of resource file
« Reply #6 on: March 10, 2020, 09:31:58 am »
You might want to test if disabling $LONGSTRINGS feature (aka reference counted strings) helps.  https://www.freepascal.org/docs-html/prog/progsu25.html

It will help in so far that his resources will be broken, because the strings are longer than 255 characters.

Pascal

  • Hero Member
  • *****
  • Posts: 879
Re: Compile time of resource file
« Reply #7 on: March 10, 2020, 01:42:04 pm »
You might want to test if disabling $LONGSTRINGS feature (aka reference counted strings) helps.  https://www.freepascal.org/docs-html/prog/progsu25.html

It will help in so far that his resources will be broken, because the strings are longer than 255 characters.

 :D

But what is the reason for the slowdown. I couldn't remember that compile times were that bad in the past. Compiling my project in Lazarus seems to stop for half a minute now.

laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1909)

winni

  • Hero Member
  • *****
  • Posts: 1359
Re: Compile time of resource file
« Reply #8 on: March 10, 2020, 02:21:23 pm »
Hi!

In the Laz resource strings unprintable chars below <= #32 are not allowed.

So space has to be #32 or '  ' and so on.

The same for chars > #127

Maxbe that is the reason.


Winni

Pascal

  • Hero Member
  • *****
  • Posts: 879
Re: Compile time of resource file
« Reply #9 on: March 10, 2020, 09:09:49 pm »
Can't be true! The two embedded pdf files work as expeced, so no issues.
The only problem i have is the very long compile time. This is not a drama, just curious, because they were unnoticeable some time agao.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1909)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8391
  • FPC developer.
Re: Compile time of resource file
« Reply #10 on: March 10, 2020, 10:17:04 pm »
But what is the reason for the slowdown. I couldn't remember that compile times were that bad in the past. Compiling my project in Lazarus seems to stop for half a minute now.

Probably the support for Unicode as Cyrax already said

 

TinyPortal © 2005-2018