[fpc-devel] about commit r29324
Hi, forwarded from Zeljko: It's about fpc issue http://bugs.freepascal.org/view.php?id=26370 It seems that TVariantArrayIterator.AtEnd loops for all Dims for no reason, so have impact on performance. *current implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then result:=true; end; *optimized implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then begin result:=true; break; end; end; Thanks. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] about commit r29324
28.12.2014 17:36, Michael Van Canneyt пишет: On Sun, 28 Dec 2014, Mattias Gaertner wrote: Hi, forwarded from Zeljko: It's about fpc issue http://bugs.freepascal.org/view.php?id=26370 It seems that TVariantArrayIterator.AtEnd loops for all Dims for no reason, so have impact on performance. *current implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then result:=true; end; *optimized implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then begin result:=true; break; end; end; Or, better yet var i : sizeint; begin Result:=false; I:=0; While (Not Result) and (I=Pred(Dims)) do begin Result:= Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount; Inc(I); end; end; People really don't seem to get booleans, and why they scorn While is beyond me. All these ugly break statements :( You may optimize even more by calculating Max:=pred(dims) once and doing I=Max; Actually, in this particular case performance optimizations are pretty useless: - TVariantArrayIterator.AtEnd method is called just once to decide whether it is necessary to iterate the array. Its usage is not typical for iterators, where such methods are called in a loop. - To return False, it has to iterate all dimensions. After that, iterating the data of variant array will take orders of magnitude more time. - Early exit can happen only for arrays with zero-sized dimension, which is basically invalid and indicates programmer's mistake elsewhere. Regards, Sergei ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] about commit r29324
On Sun, 28 Dec 2014, Sergei Gorelkin wrote: 28.12.2014 17:36, Michael Van Canneyt пишет: On Sun, 28 Dec 2014, Mattias Gaertner wrote: Hi, forwarded from Zeljko: It's about fpc issue http://bugs.freepascal.org/view.php?id=26370 It seems that TVariantArrayIterator.AtEnd loops for all Dims for no reason, so have impact on performance. *current implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then result:=true; end; *optimized implementation* function TVariantArrayIterator.AtEnd: Boolean; var i : sizeint; begin result:=false; for i:=0 to Pred(Dims) do if Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount then begin result:=true; break; end; end; Or, better yet var i : sizeint; begin Result:=false; I:=0; While (Not Result) and (I=Pred(Dims)) do begin Result:= Coords^[i] = Bounds^[i].LowBound + Bounds^[i].ElementCount; Inc(I); end; end; People really don't seem to get booleans, and why they scorn While is beyond me. All these ugly break statements :( You may optimize even more by calculating Max:=pred(dims) once and doing I=Max; Actually, in this particular case performance optimizations are pretty useless: - TVariantArrayIterator.AtEnd method is called just once to decide whether it is necessary to iterate the array. Its usage is not typical for iterators, where such methods are called in a loop. - To return False, it has to iterate all dimensions. After that, iterating the data of variant array will take orders of magnitude more time. - Early exit can happen only for arrays with zero-sized dimension, which is basically invalid and indicates programmer's mistake elsewhere. All this may of course be true for this particular case, but it's in general always better to have optimized code. So I have committed the code as I replied it (after testing that the test program still performs as expected). Michael.___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] about commit r29324
On Sun, 28 Dec 2014 15:36:49 +0100 (CET) Michael Van Canneyt mich...@freepascal.org wrote: [...] People really don't seem to get booleans, and why they scorn While is beyond me. All these ugly break statements :( You may optimize even more by calculating Max:=pred(dims) once and doing I=Max; Isn't for easier to optimize for the compiler than while. Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] about commit r29324
On Sun, 28 Dec 2014, Mattias Gaertner wrote: On Sun, 28 Dec 2014 15:36:49 +0100 (CET) Michael Van Canneyt mich...@freepascal.org wrote: [...] People really don't seem to get booleans, and why they scorn While is beyond me. All these ugly break statements :( You may optimize even more by calculating Max:=pred(dims) once and doing I=Max; Isn't for easier to optimize for the compiler than while. Now you're asking too much, I do not know this. At least the for code has 2 branches more than my code :) Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Question about building fpc for linux_x86 vs linux_x64
Hi, I have built FPC from trunk - thanks to fpcup!!! For linux_x64 it built as is - great! For linux_x86 I had to add dependencies for rtl-objpas, rtl-extras, rtl-console and fcl-base to the following packages: M ide/fpmake.pp M utils/fpdoc/fpmake.pp M utils/fpmake.pp M utils/fppkg/fpmake.pp M utils/pas2jni/fpmake.pp M utils/pas2ut/fpmake.pp M utils/unicode/fpmake.pp What I do not understand is the following - why these missing dependencies were not required for linux_x64? Thanks, Gennady PS. I can submit changes (i guess?) or send a patch file if somebody needs it. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64
On 12/28/2014 06:35 PM, Gennady Agranov wrote: I have built FPC from trunk - thanks to fpcup!!! For linux_x64 it built as is - great! For linux_x86 I had to add dependencies for rtl-objpas, rtl-extras, rtl-console and fcl-base to the following packages: M ide/fpmake.pp M utils/fpdoc/fpmake.pp M utils/fpmake.pp M utils/fppkg/fpmake.pp M utils/pas2jni/fpmake.pp M utils/pas2ut/fpmake.pp M utils/unicode/fpmake.pp What I do not understand is the following - why these missing dependencies were not required for linux_x64? What I do not understand is why you needed theses changes in the first place? Can you send the commands you used to compile fpc, and the last part of the output? PS. I can submit changes (i guess?) or send a patch file if somebody needs it. No, you do not have enough permissions to commit. But can you send the patch, so that I can see what you've changed? Regards, Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64
In our previous episode, Joost van der Sluis said: What I do not understand is the following - why these missing dependencies were not required for linux_x64? What I do not understand is why you needed theses changes in the first place? Can you send the commands you used to compile fpc, and the last part of the output? PS. I can submit changes (i guess?) or send a patch file if somebody needs it. No, you do not have enough permissions to commit. But can you send the patch, so that I can see what you've changed? In addition my observations: 1. Sounds like fpmake doesn't recursively add dependencies? e.g. rtl-objpas should come as dep of fcl-base. 2. if the patch just adds ALL those dependencies to all those packages, are they really tested as being really required for all of those? E.g. I can't imagine rtl-console be needed for so many of them. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64
No, you do not have enough permissions to commit. But can you send the patch, so that I can see what you've changed? output of svn diff attached :) Thanks, Gennady Regards, Joost. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Index: ide/fpmake.pp === --- ide/fpmake.pp (revision 29352) +++ ide/fpmake.pp (working copy) @@ -158,7 +158,11 @@ P.Directory:=ADirectory; {$endif ALLPACKAGES} +P.Dependencies.Add('fcl-base'); +P.Dependencies.Add('fcl-xml'); P.Dependencies.Add('rtl-extra'); +P.Dependencies.Add('rtl-console'); +P.Dependencies.Add('rtl-objpas'); P.Dependencies.Add('fv'); P.Dependencies.Add('chm'); { This one is only needed if DEBUG is set } Index: utils/fpdoc/fpmake.pp === --- utils/fpdoc/fpmake.pp (revision 29352) +++ utils/fpdoc/fpmake.pp (working copy) @@ -30,6 +30,7 @@ P.Dependencies.Add('fcl-xml'); P.Dependencies.Add('fcl-passrc'); P.Dependencies.Add('fcl-process'); +P.Dependencies.Add('rtl-objpas'); P.Dependencies.Add('chm'); P.Dependencies.Add('univint',[darwin,iphonesim]); Index: utils/fpmake.pp === --- utils/fpmake.pp (revision 29352) +++ utils/fpmake.pp (working copy) @@ -63,6 +63,7 @@ P.Dependencies.Add('fcl-base'); P.Dependencies.Add('paszlib'); + P.Dependencies.Add('rtl-objpas'); P.Dependencies.Add('hash'); P.Dependencies.Add('univint',[darwin,iphonesim]); Index: utils/fppkg/fpmake.pp === --- utils/fppkg/fpmake.pp (revision 29352) +++ utils/fppkg/fpmake.pp (working copy) @@ -40,6 +40,8 @@ P.Dependencies.Add('fcl-process'); P.Dependencies.Add('fcl-net'); P.Dependencies.Add('paszlib'); +P.Dependencies.Add('rtl-extra'); +P.Dependencies.Add('rtl-objpas'); //P.Dependencies.Add('libcurl',[beos,haiku,freebsd,darwin,iphonesim,solaris,netbsd,openbsd,linux,aix]); P.Dependencies.Add('fppkg'); P.Dependencies.Add('univint', [Darwin, iphonesim]); Index: utils/pas2jni/fpmake.pp === --- utils/pas2jni/fpmake.pp (revision 29352) +++ utils/pas2jni/fpmake.pp (working copy) @@ -29,6 +29,7 @@ P.Dependencies.Add('fcl-base'); P.Dependencies.Add('fcl-process'); P.Dependencies.Add('fcl-json'); +P.Dependencies.Add('rtl-objpas'); T:=P.Targets.AddImplicitUnit('def.pas'); T.Install := false; Index: utils/pas2ut/fpmake.pp === --- utils/pas2ut/fpmake.pp (revision 29352) +++ utils/pas2ut/fpmake.pp (working copy) @@ -26,6 +26,7 @@ P.Directory:=ADirectory; P.Version:='2.7.1'; +P.Dependencies.Add('fcl-base'); P.Dependencies.Add('fcl-passrc'); T:=P.Targets.AddProgram('pas2ut.pp'); Index: utils/unicode/fpmake.pp === --- utils/unicode/fpmake.pp (revision 29352) +++ utils/unicode/fpmake.pp (working copy) @@ -27,6 +27,7 @@ {$endif ALLPACKAGES} P.Version:='2.7.1'; P.Dependencies.Add('rtl'); +P.Dependencies.Add('rtl-objpas'); P.Dependencies.Add('fcl-base'); P.Dependencies.Add('fcl-xml'); ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64
1. Sounds like fpmake doesn't recursively add dependencies? e.g. rtl-objpas should come as dep of fcl-base. 2. if the patch just adds ALL those dependencies to all those packages, are they really tested as being really required for all of those? I knew that I should be more verbose in my original e-mail - my apologies... No, there was no need to add ALL dependencies - *rtl-objpas, rtl-extras, rtl-console and fcl-base* to ALL fpmake instances: M ide/fpmake.pp M utils/fpdoc/fpmake.pp M utils/fpmake.pp M utils/fppkg/fpmake.pp M utils/pas2jni/fpmake.pp M utils/pas2ut/fpmake.pp M utils/unicode/fpmake.pp I was adding dependencies one by one - after compilation error about unresolved used unit I was looking for the package that contains this unit and adding the missing dependency - for every compilation error and for every fpmake instance. But all these added dependencies were from this list... It is not a big deal, though it took several iterations. What I really want to understand (or get some opinion) - why linux_x64 build did not have these issues BTW - one of the missing units was variants (from rtl-objpas) And you were already fixing similar issue in different fpmake.pp - http://bugs.freepascal.org/view.php?id=26630 Fixed by adding rtl-objpas to dependencies. Don't understand though why this doesn't lead to problems under supported (2.6.4) circumstances. Variants usage is in fpjson from the beginning since rev r85xx So the mystery continuous :) Thanks, Gennady PS. I probalbly should have compare build logs between linux_x86 and linux_x64... ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64
1. Sounds like fpmake doesn't recursively add dependencies? e.g. rtl-objpas should come as dep of fcl-base. I am not familar at all with fpmake design - if fcl-base depends on rtl-objpas - does it mean that rtl-objpas dependency is exported - i.e. -Fu to rtl-objpas will be added if only fcl-base dependency is added in fpmake.pp? I had to add dependency to rtl-objpas in several fpmake instances - even though fcl-base was already there :( On 12/28/2014 5:49 PM, Marco van de Voort wrote: In our previous episode, Joost van der Sluis said: What I do not understand is the following - why these missing dependencies were not required for linux_x64? What I do not understand is why you needed theses changes in the first place? Can you send the commands you used to compile fpc, and the last part of the output? PS. I can submit changes (i guess?) or send a patch file if somebody needs it. No, you do not have enough permissions to commit. But can you send the patch, so that I can see what you've changed? In addition my observations: 1. Sounds like fpmake doesn't recursively add dependencies? e.g. rtl-objpas should come as dep of fcl-base. 2. if the patch just adds ALL those dependencies to all those packages, are they really tested as being really required for all of those? E.g. I can't imagine rtl-console be needed for so many of them. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel