daft-udf-tuning

Optimize User-Defined Functions for performance.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "daft-udf-tuning" with this command: npx skills add eventual-inc/daft/eventual-inc-daft-daft-udf-tuning

Daft UDF Tuning

Optimize User-Defined Functions for performance.

UDF Types

Type Decorator Use Case

Stateless @daft.func

Simple transforms. Use async for I/O-bound tasks.

Stateful @daft.cls

Expensive init (e.g., loading models). Supports gpus=N .

Batch @daft.func.batch

Vectorized CPU/GPU ops (NumPy/PyTorch). Faster.

Quick Recipes

  1. Async I/O (Web APIs)

@daft.func async def fetch(url: str): async with aiohttp.ClientSession() as s: return await s.get(url).text()

  1. GPU Batch Inference (PyTorch/Models)

@daft.cls(gpus=1) class Classifier: def init(self): self.model = load_model().cuda() # Run once per worker

@daft.method.batch(batch_size=32)
def predict(self, images):
    return self.model(images.to_pylist())

Run with concurrency

df.with_column("preds", Classifier(max_concurrency=4).predict(df["img"]))

Tuning Keys

  • max_concurrency : Total parallel UDF instances.

  • gpus=N : GPU request per instance.

  • batch_size : Rows per call. Too small = overhead; too big = OOM.

  • into_batches(N) : Pre-slice partitions if memory is tight.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

daft-docs-navigation

No summary provided by upstream source.

Repository SourceNeeds Review
General

daft-distributed-scaling

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

daft-worktree-workflow

No summary provided by upstream source.

Repository SourceNeeds Review
Web3

china-sportswear-outdoor-sourcing

Comprehensive sportswear and outdoor equipment sourcing guide for international buyers – provides detailed information about China's athletic apparel, footwear, outdoor gear, and accessories manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated