Much of this stack, from 25 `std::__basic_future::wait` to 8 `operator()` is C++ standard library implementation details for running a a task potentially in multiple threads with `std::async`.
Key thing to find out is whether Geany has enabled multithreaded layout by calling `SCI_SETLAYOUTTHREADS`. The same code will run single threaded but uses the `deferred` policy which is equivalent to just calling the task.
A potential clue is the apparent size of the vector being processed by `LayoutSegments`: 1499999 so 1.5 million segments (lexemes like number or identifier) in a wide line of text although the piece of that text being measured by `MeasureWidthsUTF8` is just "728333".