Skip to main content
Follow these best practices to get the most out of tif1 in terms of performance, reliability, and code quality.

Performance best practices

Best Practices Workflow

Use selective data loading

Control what data gets fetched to optimize performance. Only load what you need.

Batch telemetry fetching

Never fetch telemetry in a loop. Use batch methods instead.

Choose the right lib

Use polars for large datasets and performance-critical code.

Keep caching enabled

Never disable caching unless absolutely necessary.

Code quality best practices

Use Type Hints

tif1 provides comprehensive type hints. Use them for better IDE support.

Use context managers for resources

When working with exports or databases, use context managers.

Data analysis best practices

Filter early, aggregate late

Filter data as early as possible to reduce memory usage.

Clean data before analysis

Always filter out invalid laps before analysis.

Use Vectorized Operations

Avoid loops when working with DataFrames.

Reliability best practices

Check data availability first

Before processing multiple sessions, check what’s available.

Enable debug logging for troubleshooting

When debugging, enable detailed logging.

Memory management best practices

Process data in chunks

For large-scale analysis, process drivers one at a time.

Use Polars for large datasets

Polars uses significantly less memory than pandas.

Clear cache periodically

For long-running applications, clear old cache entries.

Testing best practices

Mock network calls in tests

Don’t hit the real CDN in unit tests.

Use small datasets for tests

Test with minimal data to keep tests fast.

Documentation best practices

Document your analysis

Add docstrings and comments to your analysis code.
Last modified on March 5, 2026