perl5
perl5 copied to clipboard
10 ms loss, 4.5 MB big charclass_invlists.h is parsed and discarded in all .obj files
Description
Using Windows Strace, I notice the CC is pulling in the 4.5 MB charclass_invlists.h in every single .o file. %99.99 percent of it will be discarded by the CPP, but the compile time lost is measurable. Not including a formal patch since which integer const macro defs become global and which stay in that 4.5 MB .h isnt my expertise.
executing cl -c -I.. -Ifull -nologo -GF -W3 -MD -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DPERLDLL -DPERL_CORE -O1 -Zi -GL -fp:precise -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -Fo..\av.obj -Fd..\av.pdb ..\av.c
BEFORE
Exit code : 0
Elapsed time : 0.50
Kernel time : 0.06 (12.5%)
User time : 0.44 (87.5%)
page fault # : 11127
Working set : 29992 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164400 KB
Exit code : 0
Elapsed time : 0.48
Kernel time : 0.05 (9.8%)
User time : 0.41 (84.7%)
page fault # : 11109
Working set : 29944 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164392 KB
Exit code : 0
Elapsed time : 0.49
Kernel time : 0.09 (19.1%)
User time : 0.39 (79.4%)
page fault # : 11118
Working set : 29956 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164396 KB
AFTER
Exit code : 0
Elapsed time : 0.43
Kernel time : 0.06 (14.5%)
User time : 0.34 (79.6%)
page fault # : 11108
Working set : 29920 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164332 KB
Exit code : 0
Elapsed time : 0.42
Kernel time : 0.08 (18.4%)
User time : 0.34 (80.9%)
page fault # : 10903
Working set : 29908 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164328 KB
Exit code : 0
Elapsed time : 0.42
Kernel time : 0.03 (7.4%)
User time : 0.36 (84.6%)
page fault # : 10905
Working set : 29924 KB
Paged pool : 394 KB
Non-paged pool : 11 KB
Page file size : 164336 KB
experiment patch for perl.h that saved 10 ms
#include "handy.h"
#if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) \
|| defined(PERL_IN_XSUB_RE) || defined(PERL_IN_REGEXEC_C)
# include "charclass_invlists.h"
#endif
#ifndef MAX_FOLD_FROMS
#define MAX_FOLD_FROMS 3
#endif
#ifndef NUM_ANYOF_CODE_POINTS
#define NUM_ANYOF_CODE_POINTS (1 << 8)
#endif
Steps to Reproduce
Use strace on a C compiler process, watch it read with IO calls the 4.5 MB charclass_invlists.h file, to the end, when compiling every single perl .o file.
Expected behavior
Do not #include that file by default in perl headers. Only .c files that want it should #include it. which should be a very small count.
Perl configuration
perl 5.41.5