MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / perf_native_postgres

Function perf_native_postgres

xtask/src/main.rs:1947–2142  ·  view source on GitHub ↗
(args: &[String])

Source from the content-addressed store, hash-verified

1945}
1946
1947fn perf_native_postgres(args: &[String]) -> Result<()> {
1948 let mut postgres_bin = env::var("PGLITE_OXIDE_NATIVE_POSTGRES")
1949 .map(PathBuf::from)
1950 .unwrap_or_else(|_| PathBuf::from("postgres"));
1951 let mut initdb_bin = env::var("PGLITE_OXIDE_NATIVE_INITDB")
1952 .map(PathBuf::from)
1953 .unwrap_or_else(|_| PathBuf::from("initdb"));
1954 let mut suite = BenchmarkSuiteFilter::Speed;
1955 let mut speed_sql_source = SpeedSqlSource::PgliteVendored;
1956 let mut rtt_iterations = 100usize;
1957 let mut client_mode = NativePostgresClientMode::TokioPostgresSimple;
1958 let mut cursor = 0usize;
1959 while cursor < args.len() {
1960 match args[cursor].as_str() {
1961 "--postgres-bin" => {
1962 cursor += 1;
1963 postgres_bin = PathBuf::from(
1964 args.get(cursor)
1965 .ok_or_else(|| anyhow!("--postgres-bin requires a value"))?,
1966 );
1967 }
1968 "--initdb-bin" => {
1969 cursor += 1;
1970 initdb_bin = PathBuf::from(
1971 args.get(cursor)
1972 .ok_or_else(|| anyhow!("--initdb-bin requires a value"))?,
1973 );
1974 }
1975 "--suite" => {
1976 cursor += 1;
1977 let value = args
1978 .get(cursor)
1979 .ok_or_else(|| anyhow!("--suite requires a value"))?;
1980 suite = match value.as_str() {
1981 "all" => BenchmarkSuiteFilter::All,
1982 "rtt" | "roundtrip" | "round-trip" => BenchmarkSuiteFilter::Rtt,
1983 "speed" | "sqlite" | "sqlite-suite" => BenchmarkSuiteFilter::Speed,
1984 other => bail!("unknown --suite value {other:?}; use all, rtt, or speed"),
1985 };
1986 }
1987 "--iterations" => {
1988 cursor += 1;
1989 let value = args
1990 .get(cursor)
1991 .ok_or_else(|| anyhow!("--iterations requires a value"))?;
1992 rtt_iterations = value
1993 .parse()
1994 .with_context(|| format!("parse --iterations value {value:?}"))?;
1995 }
1996 "--speed-source" => {
1997 cursor += 1;
1998 let value = args
1999 .get(cursor)
2000 .ok_or_else(|| anyhow!("--speed-source requires a value"))?;
2001 speed_sql_source = match value.as_str() {
2002 "generated" | "local" => SpeedSqlSource::Generated,
2003 "pglite" | "pglite-vendored" | "upstream" => SpeedSqlSource::PgliteVendored,
2004 other => {

Callers 1

perfFunction · 0.85

Calls 14

lenMethod · 0.80
elapsedMethod · 0.80
buildMethod · 0.80
includesMethod · 0.80
pushMethod · 0.80
source_modelMethod · 0.80

Tested by

no test coverage detected