[build2] LTO and parallelization with build2

Boris Kolpackov boris at codesynthesis.com
Sat Aug 8 13:47:15 UTC 2020


Matthew Krupcale <mkrupcale at matthewkrupcale.com> writes:

> I also looked into the Clang situation, and it looks like it only
> allows control of the number of threads/jobs when -flto=thin is
> used[2-4]. This is controlled with -flto-jobs=N since version 4 I
> think[5].

I suppose we could have added -flto-jobs=N if there is -flto=thin
and no user-supplied -flto-jobs. But maybe let's leave it for if/when
someone needs it (I am not familiar with -flto=thin and whether it
is used in practice).


> I wonder if instead of adding the _position variations, it might make
> sense to change the API of the existing functions to work more like
> e.g. std::find{,_if}. This would allow you to use the same function
> for either examining the value found (i.e. *it) or working with the
> position (i.e. it). Although, I don't know if you could adapt the
> functions which take a const lookup& to this API.

No, lookup versions won't fit. Also, IMO, std::find* API's usability
is awful. It may be general and composable, but every time I write
something along these lines I cringe:

auto i (find_if (v.begin (), v.end (), ...));
if (i != v.end ())
  ...

Compare:

if (const string* o = find_option_prefix (..., v))
  ...

Maybe we could add iterator-based versions along these lines:

template <typename I>
I
find_option_prefix (const char* prefix, I, I, bool = false);



More information about the users mailing list