> ## Documentation Index
> Fetch the complete documentation index at: https://react-native-livechart.brandtnewlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Candle work benchmark

> Compare candle path construction and validate production rectangle reuse.

Open **Candle work benchmark** from the demo home screen (`/demo/candle-work`).
The two panels receive the same moving viewport, live candle and changing price
range. Switch between sharp/rounded bodies and 40/200 candles to compare the
current rendering with a one-pass worklet prototype.

Both panels keep four batched paths: up/down bodies and up/down wicks. This
experiment does not replace batches with individual candle draw calls.

## Run the measurement

Press **Run paired benchmark**. The preview pauses while a UI worklet measures
three versions with real Skia builders:

1. **Main:** build geometry objects, then scan bodies and wicks for each color.
2. **One pass:** calculate each candle and emit directly into the four builders,
   reusing rectangle input objects.
3. **Production:** use the same body-path helper as `useCandlePaths`. It keeps the
   geometry and four scans, but reuses one plain rectangle within each body-path
   rebuild instead of calling `Skia.XYWHRect` for every sharp body.

The benchmark uses 6,000 history candles and windows containing approximately
40, 200 and 1,000 candles, plus partially visible/live candles. It warms up each
version, rotates their order over seven rounds, and reports median milliseconds
per rebuild. Each round rebuilds 40 times. **Show raw samples** exposes every
round for comparison. Native path commands are compared outside timed loops.

The times include geometry, builder calls and four `detach()` operations. They
exclude the engine, rendering, GPU, React and mapper scheduling. The preview is
a visual comparison; it is not a display-FPS measurement.

## What this experiment shows

On the dedicated iOS simulator development build, reusing rectangle inputs alone
provided essentially the same improvement as the full one-pass rewrite for sharp
candles. Rounded candle timings were essentially unchanged in the production-helper rerun. The larger rewrite is
therefore not justified by timing alone.

The smaller rectangle-reuse change is now integrated in the production candle
hook. The one-pass rewrite remains a demo-only prototype. Rectangle inputs are
local to each worklet invocation; mutable scratch is not shared between React
and the UI runtime. No new public prop or native helper is introduced. Physical
device/release validation remains outstanding. These results do not establish
CPU, battery, heap retention or whole-chart FPS improvements.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.