← Back to context

Comment by antsinmypants

1 month ago

> - It can be pretty performant if you do it right. For example, with some thought I got many days down to double digit microseconds.

Was this the time of everything or just the time of your code after loading in the text file etc.? The hello world starter takes around 110 ms to run on my PC via the script generated with `gleam export erlang-shipment` and 190 ms with `gleam run`. Is there a way to make this faster, or is the startup time an inherent limitation of Gleam/the BEAM VM?

The time reported by the "gladvent" package when running with the "--timed" option. AFAICT that does not count compilation (if needed), VM startup time, any JITting happening, or reading in the text file. I'm fine with that tbh, I'm more interested in the time actually spent solving the problem. For other languages I wouldn't count language-specific time like compilation time either.

As to whether you can make startup time faster, I suppose you could keep a BEAM running at all times and have your CLI tools hotswap in some code, run it, and get the results back out or something. That way you can skip VM startup time. Since the BEAM is targeted more at very long-running (server) processes with heaps and heaps of concurrency, I don't think ultrafast startup time is really a focus of it.