Sinter.Performance (Sinter v0.0.1)
View SourcePerformance monitoring and optimization utilities for Sinter.
This module provides tools for monitoring validation performance and optimizing schemas for high-throughput scenarios common in DSPEx.
Summary
Functions
Analyzes memory usage during validation.
Benchmarks validation performance for a schema and dataset.
Profiles schema complexity for optimization recommendations.
Functions
@spec analyze_memory_usage(Sinter.Schema.t(), [map()]) :: map()
Analyzes memory usage during validation.
Useful for optimizing memory consumption in long-running DSPEx programs.
Parameters
schema
- The schema to analyzedataset
- Sample data for analysis
Returns
- Map with memory usage statistics
@spec benchmark_validation(Sinter.Schema.t(), [map()], keyword()) :: map()
Benchmarks validation performance for a schema and dataset.
Returns timing information useful for optimizing DSPEx programs.
Parameters
schema
- The schema to benchmarkdataset
- Sample data for benchmarkingopts
- Benchmark options
Options
:iterations
- Number of iterations to run (default: 1000):warmup
- Number of warmup iterations (default: 100)
Returns
- Map with timing statistics
Examples
iex> schema = Sinter.Schema.define([{:id, :integer, [required: true]}])
iex> dataset = [%{"id" => 1}, %{"id" => 2}, %{"id" => 3}]
iex> stats = Sinter.Performance.benchmark_validation(schema, dataset)
iex> is_number(stats.avg_time_microseconds)
true
@spec profile_schema_complexity(Sinter.Schema.t()) :: map()
Profiles schema complexity for optimization recommendations.
Analyzes a schema to identify potential performance bottlenecks and suggests optimizations for DSPEx usage.
Parameters
schema
- The schema to profile
Returns
- Map with complexity analysis and optimization suggestions