1# libnativewindow Benchmarks
2
3This directory contains benchmarks for the C++ and Rust variants of
4libnativewindow.
5
6## Running
7
8It is currently a little tricky to get statistics from Rust benchmarks directly
9from tradefed. But we can hack it by using atest to build/push, then running
10the benchmarks by hand to get stats.
11
12```
13  $ atest nativewindow_buffer_benchmarks_rs nativewindow_buffer_benchmarks_cc -d
14  $ adb shell /data/local/tmp/nativewindow_buffer_benchmarks_cc/x86_64/nativewindow_buffer_benchmarks_cc
15  $ adb shell /data/local/tmp/nativewindow_buffer_benchmarks_rs/x86_64/nativewindow_buffer_benchmarks_rs --bench
16```
17
18## Results
19
20On a remote emulator, the results we see from the benchmarks from Rust and C++
21seem to be roughly equivalent! Allocating/deallocating a 720p buffer takes
22~2.3ms on each.
23