(args: &[String])
| 2534 | } |
| 2535 | |
| 2536 | fn perf_prepared_updates(args: &[String]) -> Result<()> { |
| 2537 | let mut rows = 25_000usize; |
| 2538 | let mut skip_native = false; |
| 2539 | let mut gate = false; |
| 2540 | let mut cursor = 0usize; |
| 2541 | while cursor < args.len() { |
| 2542 | match args[cursor].as_str() { |
| 2543 | "--skip-native" => { |
| 2544 | skip_native = true; |
| 2545 | } |
| 2546 | "--gate" => { |
| 2547 | gate = true; |
| 2548 | } |
| 2549 | "--rows" => { |
| 2550 | cursor += 1; |
| 2551 | let value = args |
| 2552 | .get(cursor) |
| 2553 | .ok_or_else(|| anyhow!("--rows requires a value"))?; |
| 2554 | rows = value |
| 2555 | .parse() |
| 2556 | .with_context(|| format!("parse --rows value {value:?}"))?; |
| 2557 | } |
| 2558 | other => bail!("unknown perf prepared-updates flag: {other}"), |
| 2559 | } |
| 2560 | cursor += 1; |
| 2561 | } |
| 2562 | ensure!(rows > 0, "--rows must be greater than zero"); |
| 2563 | |
| 2564 | Pglite::preload()?; |
| 2565 | let numeric_updates = parsed_numeric_updates(rows)?; |
| 2566 | let text_updates = parsed_text_updates(rows)?; |
| 2567 | ensure!( |
| 2568 | numeric_updates.len() == rows && text_updates.len() == rows, |
| 2569 | "prepared update parser returned fewer rows than requested" |
| 2570 | ); |
| 2571 | |
| 2572 | let mut runs = vec![ |
| 2573 | pglite_prepared_update_run( |
| 2574 | "pglite_server_sqlx", |
| 2575 | "PgliteServer over TCP using SQLx parameterized queries and SQLx statement cache.", |
| 2576 | || run_pglite_sqlx_prepared_update_tests(&numeric_updates, &text_updates), |
| 2577 | )?, |
| 2578 | pglite_prepared_update_run( |
| 2579 | "pglite_server_tcp_tokio_postgres_prepared", |
| 2580 | "PgliteServer over TCP using tokio-postgres explicit prepared statements.", |
| 2581 | || { |
| 2582 | run_pglite_tokio_prepared_update_tests( |
| 2583 | &numeric_updates, |
| 2584 | &text_updates, |
| 2585 | PglitePreparedEndpoint::Tcp, |
| 2586 | PreparedExecution::Sequential, |
| 2587 | ) |
| 2588 | }, |
| 2589 | )?, |
| 2590 | pglite_prepared_update_run( |
| 2591 | "pglite_server_tcp_tokio_postgres_pipelined_prepared", |
| 2592 | "PgliteServer over TCP using tokio-postgres explicit prepared statements with all update futures pipelined inside one transaction.", |
| 2593 | || { |
no test coverage detected