Original bug ID: 5551 Reporter:@alainfrisch Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2013-08-31T10:48:52Z) Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general) Monitored by:@protz@jmeber
In Env.find_pers_struct, when the the .cmi file is not found, this outcome is not cached. The same lookup can thus occur over and over again with the same module name if the .cmi file is not found. This can happen in two cases:
The module name if "predef" (created internally by the compiler) --> in this case, find_pers_struct should fail immediatly.
A real module name, whose .cmi is not in the load path. This is not a fatal error if the module is only used to expand abbreviations (types are considered abstract).
I propose to define Env.persistent_structures as:
let persistent_structures =
(Hashtbl.create 17 : (string, pers_struct option) Hashtbl.t)
and store None when the .cmi file is missing.
We have seen huge speedups by applying this change (under Windows). (E.g. a 6-times speedup for a series of tests calling the toplevel on large files, from 3 minutes to 30 seconds.)
The text was updated successfully, but these errors were encountered:
We need to be careful in the toplevel, in interactive mode, because persistent_structures is not cleared between phrases, and one might want to use a .cmi file which became available only during the session.