Skip to content

Slow application start time relative to other dependencies #11

@vanderhoop

Description

@vanderhoop

Elixir 1.18.4
Erlang 27.3.3
makeup_syntact 0.1.3

Macbook OS 15.6.1
M4 Pro (14 CPU Cores, 20 GPU Cores, 24gb memory)

Hi! I dug into the application start times of the sub applications in my phoenix app, and found that makeup_syntact is taking up the vast, vast majority of the application start time.

dbg output of application start times in a phoenix app (included to show start times relative to other deps)

Enum.sort(dep_start_times_in_ms, :desc) #=> [
  {326.671, :makeup_syntect},
  {67.183, :rum_dash},
  {13.13, :tidewave},
  {6.382, :req},
  {5.59, :honeybadger},
  {5.006, :hackney},
  {4.319, :phoenix_live_reload},
  {4.133, :live_admin},
  {4.02, :yamerl},
  {3.855, :plug},
  {3.38, :phoenix},
  {2.718, :runtime_tools},
  {1.979, :phoenix_live_dashboard},
  {1.934, :swoosh},
  {1.715, :nimble_pool},
  {1.537, :postgrex},
  {1.493, :memoize},
  {1.476, :telemetry},
  {1.467, :telemetry_poller},
  {1.231, :phoenix_pubsub}
]

I thought this was due to the registering of too many lexers, but even when explicitly scoped to a single lexer via config :makeup_syntect, register_for_languages: ["html"], the problem persists.

I've traced the problem down to the following call in MakeupSyntect.Application.start/2:

:timer.tc(fn ->
  MakeupSyntect.initialize_default_syntax_set()
end)
|> dbg()

#=> {319703, :ok}

The above function is called prior to language registration. It strikes me that the configured/requested languages should be considered before initializing the entire default syntax set, as there's a good chance many of the syntaxes can safely be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions