Skip to content

Commit

Permalink
Speed up compile time for dev builds (#2304)
Browse files Browse the repository at this point in the history
* fix warning

* add --enable-dev-build

* rename flag to --enable-dev
  • Loading branch information
alanechang authored Feb 23, 2024
1 parent 8d5f840 commit 25dd149
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dune = @dune@
middle_end = @middle_end@
coverage = @coverage@
legacy_layout = @legacy_layout@
main_build_profile = @main_build_profile@
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,20 @@ AC_ARG_ENABLE([legacy-library-layout],
[legacy_layout=yes],
[legacy_layout=no])

AC_ARG_ENABLE([dev],
[AS_HELP_STRING([--enable-dev],
[Use the dev build profile for dune when building the 2nd stage.
Can speed up the compile time by a lot. (WARNING: do not use for
production compiler deployments)])],
[main_build_profile=dev],
[main_build_profile=main])

AC_SUBST([prefix])
AC_SUBST([middle_end])
AC_SUBST([dune])
AC_SUBST([coverage])
AC_SUBST([legacy_layout])
AC_SUBST([main_build_profile])

# Don't error on options that this configure script doesn't understand but
# the ocaml/ one does.
Expand Down
2 changes: 1 addition & 1 deletion native_toplevel/opttoploop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type directive_info = {

let remembered = ref Ident.empty

let rec remember phrase_name signature =
let remember phrase_name signature =
let exported = List.filter Includemod.is_runtime_component signature in
List.iteri (fun i sg ->
match sg with
Expand Down
2 changes: 1 addition & 1 deletion ocaml/Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ define dune_main_context
(lang dune 2.8)
(context (default
(name main)
(profile main)
(profile $(main_build_profile))
(paths
(PATH ("$(CURDIR)/_build/_bootinstall/bin" :standard))
(OCAMLLIB ("$(CURDIR)/_build/install/runtime_stdlib/lib/ocaml_runtime_stdlib")))
Expand Down
4 changes: 2 additions & 2 deletions tools/merge_archives.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ let merge_cmxa0 ~archives =
incr ncmxs
end));
let cmis = Array.make !ncmis Import_info.dummy in
Hashtbl.iter (fun name (import, i) -> cmis.(i) <- import) cmi_table;
Hashtbl.iter (fun _name (import, i) -> cmis.(i) <- import) cmi_table;
let cmxs = Array.make !ncmxs Import_info.dummy in
Hashtbl.iter (fun name (import, i) -> cmxs.(i) <- import) cmx_table;
Hashtbl.iter (fun _name (import, i) -> cmxs.(i) <- import) cmx_table;
let genfns = Generic_fns.Tbl.make () in
let _, lib_units, lib_ccobjs, lib_ccopts =
List.fold_left
Expand Down

0 comments on commit 25dd149

Please sign in to comment.