You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Bug description
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:
for i = 1 to 500000 do ignore (Sys.file_exists "foobar") done;;
takes about 18s under Windows (Intel Core i5, 2.4 Ghz), and 0.8 under Linux (VIA Nano U2250, 1.6Ghz). (When "foobar" does not exist. Results are quite close when it does.)
As a side note, it seems that "_access" is about twice as fast as "stat" under Windows. Should we use it in sys.c (under Windows)?
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.
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
Bug description
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: