ocaml-ppx / ppxlib

Base library and tools for ppx rewriters
MIT License
246 stars 98 forks source link

Major slowdown on application startup time after migrating to ppxlib 0.22 from 0.15 #235

Open aryx opened 3 years ago

aryx commented 3 years ago

This is really weird, but if I update my application to ppxlib 0.22, then running the application without any argument takes 1.1s where with 0.15 it takes 0.1s. Here is the application: https://github.com/returntocorp/semgrep/blob/develop/semgrep-core/semgrep.opam This happens with ocaml 4.09.1 in native mode. With ocaml 4.10.0 (I also tried with ocaml 4.11.2), the application in native mode is still fast, but then the bytecode version takes 1.1s at startup time also.

aryx commented 3 years ago

Maybe it's not ppxlib itself but some other package that depends on it. But I opam install ppxlib.0.15.0 then I get back good performance and no more startup slowdown. Here is the output when I downgrade to ppxlib 0.15.0:

pad@yrax semgrep (develop)]$ opam install ppxlib.0.15.0
The following actions will be performed:
  ↘ downgrade ocaml-migrate-parsetree 2.1.0 to 1.8.0     [required by ppxlib]
  ↘ downgrade cstruct                 6.0.0 to 5.2.0     [required by ppx_cstruct]
  ∗ install   ppx_tools_versioned     5.4.0              [required by lwt_ppx]
  ↘ downgrade ppxlib                  0.22.0 to 0.15.0
  ↻ recompile hex                     1.4.0              [uses cstruct]
  ↻ recompile eqaf                    0.7                [uses cstruct]
  ↻ recompile asn1-combinators        0.2.4              [uses cstruct]
  ↘ downgrade cstruct-sexp            6.0.0 to 5.2.0     [uses cstruct]
  ↘ downgrade cstruct-lwt             6.0.0 to 5.2.0     [uses cstruct]
  ↘ downgrade ppx_cstruct             6.0.0 to 5.2.0     [uses ocaml-migrate-parsetree]
  ↘ downgrade lwt_ppx                 2.0.2 to 2.0.1     [uses ocaml-migrate-parsetree]
  ↻ recompile ppx_variants_conv       v0.14.1            [uses ppxlib]
  ↻ recompile ppx_stable              v0.14.1            [uses ppxlib]
  ↻ recompile ppx_pipebang            v0.14.0            [uses ppxlib]
  ↻ recompile ppx_optional            v0.14.0            [uses ppxlib]
  ↻ recompile ppx_let                 v0.14.0            [uses ppxlib]
  ↻ recompile ppx_js_style            v0.14.0            [uses ppxlib]
  ↻ recompile ppx_here                v0.14.0            [uses ppxlib]
  ↻ recompile ppx_fixed_literal       v0.14.0            [uses ppxlib]
  ↻ recompile ppx_enumerate           v0.14.0            [uses ppxlib]
  ↻ recompile ppx_compare             v0.14.0            [uses ppxlib]
  ↻ recompile ppx_cold                v0.14.0            [uses ppxlib]
  ↘ downgrade ppx_typerep_conv        v0.14.2 to v0.14.1 [uses ppxlib]
  ↘ downgrade ppx_sexp_conv           v0.14.3 to v0.14.1 [uses ppxlib]
  ↘ downgrade ppx_optcomp             v0.14.1 to v0.14.0 [uses ppxlib]
  ↘ downgrade ppx_fields_conv         v0.14.2 to v0.14.1 [uses ppxlib]
  ↘ downgrade ppx_deriving            5.2.1 to 5.1       [uses ppxlib]
  ↻ recompile ezjsonm                 1.2.0              [uses hex]
  ↻ recompile mirage-crypto           0.8.10             [uses cstruct]
  ↻ recompile hacl_x25519             0.2.2              [uses cstruct]
  ↻ recompile fiat-p256               0.2.3              [uses cstruct]
  ↻ recompile multipart-form-data     0.3.0              [uses lwt_ppx]
  ↻ recompile ppx_fail                v0.14.0            [uses ppxlib]
  ↻ recompile yaml                    2.1.0              [uses ppx_sexp_conv]
  ↻ recompile uri-sexp                4.1.0              [uses ppx_sexp_conv]
  ↻ recompile ppx_sexp_value          v0.14.0            [uses ppxlib]
↻ recompile ppx_hash                v0.14.0            [uses ppxlib]
  ↻ recompile ppx_assert              v0.14.0            [uses ppxlib]
  ↻ recompile ipaddr-sexp             5.0.1              [uses ppx_sexp_conv]
  ↘ downgrade ppx_sexp_message        v0.14.1 to v0.14.0 [uses ppxlib]
  ↘ downgrade ppx_custom_printf       v0.14.1 to v0.14.0 [uses ppxlib]
  ↻ recompile ppx_deriving_yojson     3.6.1              [uses ppxlib]
  ↻ recompile nocrypto                0.5.4-2            [uses cstruct]
  ↻ recompile mirage-crypto-rng       0.8.10             [uses cstruct]
  ↻ recompile hkdf                    1.0.4              [uses cstruct]
  ↻ recompile opium                   0.20.0             [uses multipart-form-data]
  ↻ recompile cohttp                  2.5.4              [uses ppx_sexp_conv]
  ↻ recompile ppx_base                v0.14.0            [uses ppxlib]
  ↻ recompile jst-config              v0.14.0            [uses ppx_assert]
  ↻ recompile conduit                 2.3.0              [uses ppx_sexp_conv]
  ↻ recompile bin_prot                v0.14.0            [uses ppx_compare, ppx_variants_conv]
  ↻ recompile easy_logging_yojson     git*               [uses ppx_deriving_yojson]
  ↻ recompile mirage-crypto-pk        0.8.10             [uses cstruct]
  ↻ recompile cohttp-lwt              2.5.4              [uses ppx_sexp_conv]
  ↻ recompile ppx_string              v0.14.1            [uses ppxlib]
  ↻ recompile time_now                v0.14.0            [uses ppx_base]
  ↻ recompile conduit-lwt             2.3.0              [uses ppx_sexp_conv]
  ↻ recompile ppx_bin_prot            v0.14.0            [uses ppxlib]
  ↻ recompile x509                    0.11.2             [uses cstruct]
  ↻ recompile opium_kernel            0.18.0             [uses ppx_sexp_conv]
  ↻ recompile ppx_module_timer        v0.14.0            [uses ppxlib]
  ↻ recompile ppx_inline_test         v0.14.1            [uses ppxlib]
  ↻ recompile tls                     0.12.8             [uses ppx_cstruct]
  ↻ recompile ca-certs                0.2.0              [uses mirage-crypto]
  ↻ recompile ppx_bench               v0.14.1            [uses ppxlib]
  ↘ downgrade ppx_expect              v0.14.1 to v0.14.0 [uses ppxlib]
  ↻ recompile conduit-lwt-unix        2.3.0              [uses ppx_sexp_conv]
  ↻ recompile splittable_random       v0.14.0            [uses ppx_assert]
  ↻ recompile cohttp-lwt-unix         2.5.4              [uses conduit-lwt-unix]
  ↘ downgrade base_quickcheck         v0.14.1 to v0.14.0 [uses ppxlib]
  ↻ recompile ppx_jane                v0.14.0            [uses ppxlib]
  ↻ recompile base_bigstring          v0.14.0            [uses ppx_jane]
  ↻ recompile core_kernel             v0.14.1            [uses ppx_sexp_conv]
  ↻ recompile timezone                v0.14.0            [uses core_kernel, ppx_jane]
  ↻ recompile patience_diff           v0.14.0            [uses core_kernel, ppx_jane]
  ↻ recompile core                    v0.14.1            [uses jst-config]
  ↻ recompile textutils               v0.14.0            [uses core_kernel, ppx_jane]
  ↻ recompile patdiff                 v0.14.0            [uses core_kernel, ppx_jane]
  ↻ recompile hack_parallel           1.0.1              [uses ppxlib]
  ↻ recompile shell                   v0.14.0            [uses jst-config]
  ↻ recompile comby                   1.2.2              [uses ppxlib]
===== ∗ 1   ↻ 64   ↘ 16 =====
Do you want to continue? [Y/n] y