quickwit-oss / quickwit

Cloud-native search engine for observability. An open-source alternative to Datadog, Elasticsearch, Loki, and Tempo.
https://quickwit.io
Other
8.31k stars 339 forks source link

Compile Times + Warp Types #5539

Open PSeitz opened 2 weeks ago

PSeitz commented 2 weeks ago

Quickwit compile times are pretty long, this could by some part be caused by overly complex warp types. Below is an example of such a type. We probably should break these type chains by boxing them.

Super long type > 83 (0.0%, 87.8%) 2 (0.0%, 65.4%) core::ptr::drop_in_place>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::get_index_metadata>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>,warp::filter::map::Map>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::list_indexes_metadata>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response,quickwit_proto::metastore::MetastoreError>>>,warp::filter::map::Map>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>>,warp::filter::and_then::AndThen::{{closure}},futures_util::future::ready::Ready,warp::reject::Rejection>>>::{{closure}}>,quickwit_serve::format::extract_config_format::{{closure}}>>,warp::filter::untuple_one::UntupleOne::{{closure}},futures_util::future::ready::Ready>>::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>>>,warp::filter::and_then::AndThen>>::{{closure}}>,warp::filters::body::bytes::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,warp::filter::map::Map>::{{closure}}>>,quickwit_serve::index_api::rest_handler::create_index>,quickwit_serve::index_api::rest_handler::log_failure::{{closure}}>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen::{{closure}},futures_util::future::ready::Ready,warp::reject::Rejection>>>::{{closure}}>,quickwit_serve::format::extract_config_format::{{closure}}>>,warp::filter::untuple_one::UntupleOne::{{closure}},futures_util::future::ready::Ready>>::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>>>,warp::filter::and_then::AndThen>>::{{closure}}>,warp::filters::body::bytes::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::update_index>,quickwit_serve::index_api::rest_handler::log_failure::{{closure}}>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::clear_index>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response<(),quickwit_index_management::index::IndexServiceError>>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::delete_index>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response,quickwit_index_management::index::IndexServiceError>>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::list_splits>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::describe_index>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and::And::{{closure}},futures_util::future::ready::Ready>>::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>>,warp::filter::and_then::AndThen::{{closure}}>,warp::filter::and_then::AndThen>>::{{closure}}>,warp::filters::body::bytes::{{closure}}>>,warp::filters::body::json::{{closure}}>>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::mark_splits_for_deletion>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response<(),quickwit_proto::metastore::MetastoreError>>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::reset_source_checkpoint>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response<(),quickwit_proto::metastore::MetastoreError>>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and::And::{{closure}},futures_util::future::ready::Ready>>::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>>,warp::filter::and_then::AndThen::{{closure}}>,warp::filter::and_then::AndThen>>::{{closure}}>,warp::filters::body::bytes::{{closure}}>>,warp::filters::body::json::{{closure}}>>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::toggle_source>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response<(),quickwit_index_management::index::IndexServiceError>>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::and_then::AndThen::{{closure}},futures_util::future::ready::Ready,warp::reject::Rejection>>>::{{closure}}>,quickwit_serve::format::extract_config_format::{{closure}}>>,warp::filter::untuple_one::UntupleOne::{{closure}},futures_util::future::ready::Ready>>::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>,warp::filters::body::content_length_limit::{{closure}}>>>,warp::filter::and_then::AndThen>>::{{closure}}>,warp::filters::body::bytes::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::create_source>,quickwit_serve::index_api::rest_handler::log_failure::{{closure}}>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::get_source>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response>>,warp::filter::map::Map>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filters::path::Exact>>,warp::filter::FilterFn::{{closure}},(alloc::string::String,)>::{{closure}}>>,warp::filter::FilterFn>,warp::filter::FilterFn::{{closure}}>>,warp::filter::map::Map::{{closure}}>>,quickwit_serve::index_api::rest_handler::delete_source>,warp::filter::map::Map>>::{{closure}}>,serde_qs::warp::query::{{closure}}>,serde_qs::warp::query::{{closure}}>,quickwit_serve::format::extract_format_from_qs::{{closure}}>>,quickwit_serve::rest_api_response::into_rest_api_response<(),quickwit_index_management::index::IndexServiceError>>>>
fulmicoton commented 2 weeks ago

Yeah boxing would probably help. Can you experiment a little?

fulmicoton commented 1 week ago

@PSeitz can we close this?

PSeitz commented 1 week ago

It's improved a lot with #5540, but some really long type chains remain.

Boxed or chains
Response type chains

We can replace the boxed or chains with a Vec, since they all contain the same box type now. Such a type doesn't seem to exist in warp yet.