diff --git a/README.md b/README.md index 7ccab0c..6300213 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ SparseIO is a Rust library for sparse, out-of-order materialization of large byt Instead of eagerly copying an entire object from source to destination, SparseIO allows you to fetch only the chunks you ask for. It tracks what is already present for efficient caching, and deduplicates concurrent reads for the same chunk.

- +SparseIO animation showing a cache miss, prefetch, and cache hit as sparse chunks materialize.

## Core Premise diff --git a/scripts/animations/README.md b/scripts/animations/README.md index 331fee7..82bdb6a 100644 --- a/scripts/animations/README.md +++ b/scripts/animations/README.md @@ -12,7 +12,7 @@ This directory holds short `manim` scenes used to generate README-friendly anima python3 -m venv .venv source .venv/bin/activate python3 -m pip install --upgrade pip -python3 -m pip install manim==0.19.0 +python3 -m pip install -r requirements.txt ``` `ffmpeg` is also required for GIF output. diff --git a/scripts/animations/common.sh b/scripts/animations/common.sh index e02db1a..fe843d1 100644 --- a/scripts/animations/common.sh +++ b/scripts/animations/common.sh @@ -8,13 +8,23 @@ VENV_DIR="$ANIMATIONS_DIR/.venv" PYTHON_BIN="$VENV_DIR/bin/python3" REQUIREMENTS_FILE="$ANIMATIONS_DIR/requirements.txt" +ensure_ffmpeg() { + if ! command -v ffmpeg >/dev/null 2>&1; then + echo "ffmpeg is required to render GIF output" >&2 + echo "install ffmpeg and rerun the render script" >&2 + exit 1 + fi +} + ensure_animation_venv() { if [[ ! -x "$PYTHON_BIN" ]]; then echo "creating animation virtualenv at $VENV_DIR" >&2 python3 -m venv "$VENV_DIR" "$PYTHON_BIN" -m pip install --upgrade pip - "$PYTHON_BIN" -m pip install -r "$REQUIREMENTS_FILE" fi + + "$PYTHON_BIN" -m pip install -r "$REQUIREMENTS_FILE" } +ensure_ffmpeg ensure_animation_venv diff --git a/scripts/animations/general-read/scene.py b/scripts/animations/general-read/scene.py index 17fcf09..bc0e226 100644 --- a/scripts/animations/general-read/scene.py +++ b/scripts/animations/general-read/scene.py @@ -9,7 +9,6 @@ UP, Arrow, Create, - DashedVMobject, FadeIn, FadeOut, FadeTransform, @@ -32,9 +31,6 @@ FONT_FAMILY = "Verdana" FILE_CHUNKS = 6 -CHUNK_SIZE_LABEL = "1 chunk" -FILE_SIZE_LABEL = "6 chunks" -PREFETCH_AHEAD_CHUNKS = 2 FRAME_STROKE = "#7F8EA3" MUTED_TEXT = "#AAB8C8" @@ -45,10 +41,8 @@ CACHE_COLOR = "#90BE6D" SUBREAD_COLOR = "#FFD166" SUBREAD_SLOT_COLOR = "#B9852A" -STREAM_COLOR = "#B5179E" MISS_COLOR = "#F94144" HIT_COLOR = "#6E9B4B" -PREFETCH_COLOR = "#577590" Text.set_default(font=FONT_FAMILY) @@ -438,23 +432,3 @@ def make_slice(self, chunk_rect: Rectangle, center_ratio: float, height_ratio: f center_y = top[1] + (bottom[1] - top[1]) * center_ratio slice_rect.move_to([chunk_rect.get_center()[0], center_y, 0]) return slice_rect - - def make_prefetch_window(self, cache: FileColumn, start_chunk: int, chunk_span: int) -> DashedVMobject: - start = max(0, min(FILE_CHUNKS - 1, start_chunk)) - end = max(start, min(FILE_CHUNKS - 1, start + chunk_span - 1)) - top = cache.chunk_rect(start).get_top() - bottom = cache.chunk_rect(end).get_bottom() - window = Rectangle( - width=cache.body.width + 0.18, - height=top[1] - bottom[1], - stroke_color=PREFETCH_COLOR, - stroke_width=2, - ) - window.move_to([cache.body.get_center()[0], (top[1] + bottom[1]) / 2, 0]) - return DashedVMobject(window, num_dashes=18) - - def make_stream_slices(self, cache: FileColumn, start_chunk: int) -> VGroup: - first = self.make_slice(cache.chunk_rect(start_chunk), 0.58, 0.26, STREAM_COLOR) - second = self.make_slice(cache.chunk_rect(start_chunk + 1), 0.42, 0.72, STREAM_COLOR) - third = self.make_slice(cache.chunk_rect(start_chunk + 2), 0.24, 0.24, STREAM_COLOR) - return VGroup(first, second, third)