-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
60 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use ascom_alpaca::benches; | ||
use criterion::criterion_main; | ||
|
||
criterion_main!(benches::client); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use super::Response; | ||
use crate::api::{ConfiguredDevice, FallibleDeviceType, ImageArray}; | ||
use crate::response::ValueResponse; | ||
use crate::ASCOMResult; | ||
use bytes::Bytes; | ||
use criterion::Criterion; | ||
use mime::APPLICATION_JSON; | ||
|
||
macro_rules! declare_parsing_benches { | ||
($($name:ident: $ty:ty => $fixture_path:literal,)*) => { | ||
/// Run response parsing benchmarks against stored fixtures. | ||
pub fn benches() { | ||
let _ = | ||
Criterion::default() | ||
.configure_from_args() | ||
$( | ||
.bench_function(stringify!($name), |b| { | ||
b.iter(move || { | ||
<$ty>::from_reqwest( | ||
APPLICATION_JSON, | ||
Bytes::from_static(include_bytes!($fixture_path)), | ||
) | ||
.expect("Failed to parse fixture") | ||
}); | ||
}) | ||
)*; | ||
} | ||
}; | ||
} | ||
|
||
declare_parsing_benches! { | ||
parse_configured_devices: ValueResponse<Vec<ConfiguredDevice<FallibleDeviceType>>> | ||
=> "resp_configured_devices.json", | ||
parse_image_array: ASCOMResult<ImageArray> | ||
=> "resp_image_array.json", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Value":[{"DeviceName":"Alpaca Camera Sim","DeviceType":"Camera","DeviceNumber":0,"UniqueID":"9244f002-d9bb-415c-a72c-740de130352f"},{"DeviceName":"Alpaca CoverCalibrator Simulator","DeviceType":"CoverCalibrator","DeviceNumber":0,"UniqueID":"5194e0dd-8b5e-4da4-95af-a33bca177f5d"},{"DeviceName":"Alpaca Dome Simulator","DeviceType":"Dome","DeviceNumber":0,"UniqueID":"0f2b36e0-5d12-4677-b06a-0a8405bd090f"},{"DeviceName":"Alpaca Filter Wheel Simulator","DeviceType":"FilterWheel","DeviceNumber":0,"UniqueID":"b5b6feef-f3c6-4f25-8455-0f21b92cb152"},{"DeviceName":"Alpaca Focuser Simulator","DeviceType":"Focuser","DeviceNumber":0,"UniqueID":"c9bcdd5b-e66b-4708-a007-d186ce1db4a0"},{"DeviceName":"Alpaca Observing Conditions Simulator","DeviceType":"ObservingConditions","DeviceNumber":0,"UniqueID":"85c5bbf3-4ea6-42a4-be37-c889b006b7f4"},{"DeviceName":"Alpaca Rotator Simulator","DeviceType":"Rotator","DeviceNumber":0,"UniqueID":"04749800-5b7d-4428-86a1-95a6b82e99c0"},{"DeviceName":"Alpaca Safety Monitor Simulator","DeviceType":"SafetyMonitor","DeviceNumber":0,"UniqueID":"92c20845-01b0-4cb3-ab39-03ee096e32e3"},{"DeviceName":"Alpaca Switch Simulator","DeviceType":"Switch","DeviceNumber":0,"UniqueID":"50f0238c-f0cd-4f98-b3e9-aaaa18ec5e29"},{"DeviceName":"Alpaca Telescope Simulator","DeviceType":"Telescope","DeviceNumber":0,"UniqueID":"fc1534af-2248-4a65-82ae-8258910f12e9"}],"ClientTransactionID":1,"ServerTransactionID":94395} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters