In some of the core module's "lib.php" files, there are functions defined which are only used in rare situations, by one single other .php file of the module in question. This policy fills up all these lib.php's with large unused code, which decreases Moodle's speed in general.
An example of an affected module is mod/data:
For instance, "lib.php" contains the definition of the function data_presets_export() which may only be called from "preset.php" - thus I am suggesting to move the function out into that file.
Please see discussion at