[fpc-pascal] Underscores in numerical literals - grouping
Florian Klaempfl
florian at freepascal.org
Fri Nov 25 20:14:46 CET 2016
Am 22.11.2016 um 15:29 schrieb Mattias Gaertner:
> You forgot to consider how scanners work, i.e. how they check and
> skip spaces.
>
> Here are some numbers:
>
> Compiling Lazarus sources 'make clean all' 1249309 lines 3 times
> 0m51.682s
> 0m51.415s
> 0m51.698s
>
> Lazarus uses indentation of 2, so replacing each double space with one
> tab saves 3.7mb. Compiling 3 times:
> 0m52.003s
> 0m51.294s
> 0m51.452s
>
> This is a desktop system, so there is always a bit of noise. As you can
> see, the time difference is not measurable.
>
> To estimate the potential speed up:
> Replacing all multi spaces with one space saves 6.1mb. Compiling 3
> times:
> 0m51.064s
> 0m50.733s
> 0m51.120s
>
> It seems scanning the spaces costs about 1%.
In case somebody is interested, the main loop for reading spaces is in
compiler/scanner.pas, procedure tscannerfile.skipspace;
More information about the fpc-pascal
mailing list