Add load-path-filter-function and use it to optimize loading
When there are many directories on load-path, the part of load which
searches load-path can become very slow. By filtering load-path up
front to only contain directories which are likely to contain the
searched-for file, load becomes much faster.
This can be set in early-init.el for maximum effect.
* lisp/startup.el (load-path-filter--cache)
(load-path-filter-cache-directory-files): Add.
* src/lread.c (Fload): Call load-path-filter-function.
(syms_of_lread): Add load-path-filter-function.
(cherry picked from commit
e5218df144203ff1b5da3d46b7579b6455008ee7)