Conversation
|
I'll test and post some build-timings later, see if +2300 trivial trait implementation lines have any effect. As I needed this while writing some Vulkan layers in Rust, the goal is to also submit a minimal layer crate for |
Easy enough to cfg-gate if needed, since it's a new trait. |
f8b31af to
ba835e9
Compare
|
$ hyperfine -p 'cargo clean -p ash' 'cargo b -p ash'
Benchmark 1: cargo b -p ash
Time (mean ± σ): 7.366 s ± 0.101 s [User: 8.313 s, System: 0.670 s]
Range (min … max): 7.248 s … 7.586 s 10 runs
$ hyperfine -p 'cargo clean -p ash' 'cargo b -p ash'
Benchmark 1: cargo b -p ash
Time (mean ± σ): 7.411 s ± 0.065 s [User: 8.358 s, System: 0.638 s]
Range (min … max): 7.305 s … 7.505 s 10 runsWe're talking approx 50ms here, nothing worth |
ba835e9 to
eb95efb
Compare
|
@Ralith How do you feel about a |
|
I've heard CI tends to give erratic timings for CPU-bound stuff due to contention, but it might be interesting to try all the same. |
eb95efb to
d1f624b
Compare
d1f624b to
a588b1c
Compare
e8e3d18 to
bb3d291
Compare
bb3d291 to
ee555fb
Compare
… with `match_struct!` macro In Vulkan layers extracing a structure based on its `s_type` is a common operation, but comparing against an enum value and subsequently casting to the right type is verbose and error-prone. By generating a `const STRUCTURE_TYPE` with the given value for every Vulkan structure it becomes possible to implement a macro that abstracts this logic away in a safer way.
`vkxml` provides the needed value as `type_enums`, and was already used like that in the `Default` implementation...
ee555fb to
3b7db4f
Compare
|
@jdtatz only noticing https://github.com/jdtatz/ash/commits/match-structure-type-more-generic just now; any reason this wasn't suggested as a change to cut down on codegen for Or is this all blocking on the recently submitted type support in |
… with `match_struct!` macro (#614) * ash: Add `const STRUCTURE_TYPE` to all Vulkan structures for matching with `match_struct!` macro In Vulkan layers extracing a structure based on its `s_type` is a common operation, but comparing against an enum value and subsequently casting to the right type is verbose and error-prone. By generating a `const STRUCTURE_TYPE` with the given value for every Vulkan structure it becomes possible to implement a macro that abstracts this logic away in a safer way. * generator: Reuse `HasStructureType::STRUCTURE_TYPE` in `s_type` initializer
Depends on #613
In Vulkan layers extracing a structure based on its
s_typeis a common operation, but comparing against an enum value and subsequently casting to the right type is verbose and error-prone.By generating a
const STRUCTURE_TYPEwith the given value for every Vulkan structure it becomes possible to implement a macro that abstracts this logic away in a safer way.