Extensions: Binary search to find generated schema.
This will ensure that finding the generated schemas is a log(num_schemas) * |number_of_api_providers| operation. We can then also remove the caching in ExtensionAPI, which should save memory for renderers. Note that since for the browser process, GetSchema is never called, ExtensionAPI::IsKnownAPI was a linear (in the number of schemas) operation (since |schemas_| is always empty). Now it'd be more efficient. This depends on the fact that our code generating logic generates schemas in sorted order. Add a static assert to ensure that it holds. Since std::is_sorted is not constexpr until c++20, modify base::STLIsSorted to be constexpr (at least for arrays which have constexpr std::begin and std::end since c++14). Example generated code: https://paste.googleplex.com/6322126191591424. BUG=None Change-Id: Ib463c7f8ca5f317ecf6900dc811fa902c72e92d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291265 Commit-Queue: Karan Bhatia <karandeepb@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#788913}
Showing
Please register or sign in to comment