Documentation
¶
Index ¶
- type ContextOptimizer
- func (o *ContextOptimizer) ClearSharedVariables()
- func (o *ContextOptimizer) GetEnableCompression() bool
- func (o *ContextOptimizer) GetEnableDeduplication() bool
- func (o *ContextOptimizer) GetEnableLazyLoading() bool
- func (o *ContextOptimizer) GetHighUsageVariables(threshold int) map[string]int
- func (o *ContextOptimizer) GetLowUsageVariables(threshold int) map[string]int
- func (o *ContextOptimizer) GetSharedVariables() map[string]string
- func (o *ContextOptimizer) GetVariableUsageCount() map[string]int
- func (o *ContextOptimizer) OptimizeTemplate(ctx context.Context, template *format.Template) (*format.Template, error)
- func (o *ContextOptimizer) OptimizeTemplates(ctx context.Context, templates []*format.Template) ([]*format.Template, error)
- func (o *ContextOptimizer) SetEnableCompression(enable bool)
- func (o *ContextOptimizer) SetEnableDeduplication(enable bool)
- func (o *ContextOptimizer) SetEnableLazyLoading(enable bool)
- type ContextOptimizerOptions
- type InheritanceOptimizer
- func (o *InheritanceOptimizer) ClearCache()
- func (o *InheritanceOptimizer) GetCacheOptimizedTemplates() bool
- func (o *InheritanceOptimizer) GetCacheSize() int
- func (o *InheritanceOptimizer) GetFlattenInheritance() bool
- func (o *InheritanceOptimizer) GetMaxInheritanceDepth() int
- func (o *InheritanceOptimizer) OptimizeTemplate(ctx context.Context, template *format.Template) (*format.Template, error)
- func (o *InheritanceOptimizer) OptimizeTemplates(ctx context.Context, templates []*format.Template) ([]*format.Template, error)
- func (o *InheritanceOptimizer) SetCacheOptimizedTemplates(cache bool)
- func (o *InheritanceOptimizer) SetFlattenInheritance(flatten bool)
- func (o *InheritanceOptimizer) SetMaxInheritanceDepth(depth int)
- type InheritanceOptimizerOptions
- type MemoryOptimizer
- func (o *MemoryOptimizer) GetConfig() *MemoryOptimizerConfig
- func (o *MemoryOptimizer) GetLastOptimizationTime() time.Time
- func (o *MemoryOptimizer) GetMemoryProfiler() *profiling.MemoryProfiler
- func (o *MemoryOptimizer) GetMemorySavings() map[string]float64
- func (o *MemoryOptimizer) GetOptimizationCount() int64
- func (o *MemoryOptimizer) GetOptimizedSizes() map[string]int
- func (o *MemoryOptimizer) GetStats() *MemoryOptimizerStats
- func (o *MemoryOptimizer) GetTemplateSizes() map[string]int
- func (o *MemoryOptimizer) OptimizeTemplate(template *format.Template) (*format.Template, error)
- func (o *MemoryOptimizer) OptimizeTemplates(templates []*format.Template) ([]*format.Template, error)
- func (o *MemoryOptimizer) SetConfig(config *MemoryOptimizerConfig)
- type MemoryOptimizerConfig
- type MemoryOptimizerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextOptimizer ¶
type ContextOptimizer struct {
// contains filtered or unexported fields
}
ContextOptimizer optimizes context variable usage in templates to reduce memory footprint and improve performance
func NewContextOptimizer ¶
func NewContextOptimizer(options *ContextOptimizerOptions) *ContextOptimizer
NewContextOptimizer creates a new context optimizer
func (*ContextOptimizer) ClearSharedVariables ¶
func (o *ContextOptimizer) ClearSharedVariables()
ClearSharedVariables clears the shared variables
func (*ContextOptimizer) GetEnableCompression ¶
func (o *ContextOptimizer) GetEnableCompression() bool
GetEnableCompression returns whether variable compression is enabled
func (*ContextOptimizer) GetEnableDeduplication ¶
func (o *ContextOptimizer) GetEnableDeduplication() bool
GetEnableDeduplication returns whether variable deduplication is enabled
func (*ContextOptimizer) GetEnableLazyLoading ¶
func (o *ContextOptimizer) GetEnableLazyLoading() bool
GetEnableLazyLoading returns whether lazy loading of variables is enabled
func (*ContextOptimizer) GetHighUsageVariables ¶
func (o *ContextOptimizer) GetHighUsageVariables(threshold int) map[string]int
GetHighUsageVariables returns variables with high usage
func (*ContextOptimizer) GetLowUsageVariables ¶
func (o *ContextOptimizer) GetLowUsageVariables(threshold int) map[string]int
GetLowUsageVariables returns variables with low usage
func (*ContextOptimizer) GetSharedVariables ¶
func (o *ContextOptimizer) GetSharedVariables() map[string]string
GetSharedVariables returns the shared variables
func (*ContextOptimizer) GetVariableUsageCount ¶
func (o *ContextOptimizer) GetVariableUsageCount() map[string]int
GetVariableUsageCount returns the variable usage count
func (*ContextOptimizer) OptimizeTemplate ¶
func (o *ContextOptimizer) OptimizeTemplate(ctx context.Context, template *format.Template) (*format.Template, error)
OptimizeTemplate optimizes context variable usage in a template
func (*ContextOptimizer) OptimizeTemplates ¶
func (o *ContextOptimizer) OptimizeTemplates(ctx context.Context, templates []*format.Template) ([]*format.Template, error)
OptimizeTemplates optimizes context variable usage in multiple templates
func (*ContextOptimizer) SetEnableCompression ¶
func (o *ContextOptimizer) SetEnableCompression(enable bool)
SetEnableCompression sets whether variable compression is enabled
func (*ContextOptimizer) SetEnableDeduplication ¶
func (o *ContextOptimizer) SetEnableDeduplication(enable bool)
SetEnableDeduplication sets whether variable deduplication is enabled
func (*ContextOptimizer) SetEnableLazyLoading ¶
func (o *ContextOptimizer) SetEnableLazyLoading(enable bool)
SetEnableLazyLoading sets whether lazy loading of variables is enabled
type ContextOptimizerOptions ¶
type ContextOptimizerOptions struct {
// EnableDeduplication enables variable deduplication
EnableDeduplication bool
// EnableLazyLoading enables lazy loading of variables
EnableLazyLoading bool
// EnableCompression enables variable compression
EnableCompression bool
}
ContextOptimizerOptions contains options for the context optimizer
func DefaultContextOptimizerOptions ¶
func DefaultContextOptimizerOptions() *ContextOptimizerOptions
DefaultContextOptimizerOptions returns default options for the context optimizer
type InheritanceOptimizer ¶
type InheritanceOptimizer struct {
// contains filtered or unexported fields
}
InheritanceOptimizer optimizes template inheritance by flattening inheritance chains and reducing the depth of template inheritance hierarchies
func NewInheritanceOptimizer ¶
func NewInheritanceOptimizer(options *InheritanceOptimizerOptions) *InheritanceOptimizer
NewInheritanceOptimizer creates a new inheritance optimizer
func (*InheritanceOptimizer) ClearCache ¶
func (o *InheritanceOptimizer) ClearCache()
ClearCache clears the template cache
func (*InheritanceOptimizer) GetCacheOptimizedTemplates ¶
func (o *InheritanceOptimizer) GetCacheOptimizedTemplates() bool
GetCacheOptimizedTemplates returns whether optimized templates are cached
func (*InheritanceOptimizer) GetCacheSize ¶
func (o *InheritanceOptimizer) GetCacheSize() int
GetCacheSize returns the size of the template cache
func (*InheritanceOptimizer) GetFlattenInheritance ¶
func (o *InheritanceOptimizer) GetFlattenInheritance() bool
GetFlattenInheritance returns whether inheritance is flattened
func (*InheritanceOptimizer) GetMaxInheritanceDepth ¶
func (o *InheritanceOptimizer) GetMaxInheritanceDepth() int
GetMaxInheritanceDepth returns the maximum allowed inheritance depth
func (*InheritanceOptimizer) OptimizeTemplate ¶
func (o *InheritanceOptimizer) OptimizeTemplate(ctx context.Context, template *format.Template) (*format.Template, error)
OptimizeTemplate optimizes a template by flattening inheritance chains and reducing the depth of template inheritance hierarchies
func (*InheritanceOptimizer) OptimizeTemplates ¶
func (o *InheritanceOptimizer) OptimizeTemplates(ctx context.Context, templates []*format.Template) ([]*format.Template, error)
OptimizeTemplates optimizes multiple templates
func (*InheritanceOptimizer) SetCacheOptimizedTemplates ¶
func (o *InheritanceOptimizer) SetCacheOptimizedTemplates(cache bool)
SetCacheOptimizedTemplates sets whether optimized templates should be cached
func (*InheritanceOptimizer) SetFlattenInheritance ¶
func (o *InheritanceOptimizer) SetFlattenInheritance(flatten bool)
SetFlattenInheritance sets whether inheritance should be flattened
func (*InheritanceOptimizer) SetMaxInheritanceDepth ¶
func (o *InheritanceOptimizer) SetMaxInheritanceDepth(depth int)
SetMaxInheritanceDepth sets the maximum allowed inheritance depth
type InheritanceOptimizerOptions ¶
type InheritanceOptimizerOptions struct {
// MaxInheritanceDepth is the maximum allowed inheritance depth
MaxInheritanceDepth int
// FlattenInheritance indicates if inheritance should be flattened
FlattenInheritance bool
// CacheOptimizedTemplates indicates if optimized templates should be cached
CacheOptimizedTemplates bool
}
InheritanceOptimizerOptions contains options for the inheritance optimizer
func DefaultInheritanceOptimizerOptions ¶
func DefaultInheritanceOptimizerOptions() *InheritanceOptimizerOptions
DefaultInheritanceOptimizerOptions returns default options for the inheritance optimizer
type MemoryOptimizer ¶
type MemoryOptimizer struct {
// contains filtered or unexported fields
}
MemoryOptimizer optimizes memory usage in template processing
func NewMemoryOptimizer ¶
func NewMemoryOptimizer(config *MemoryOptimizerConfig) (*MemoryOptimizer, error)
NewMemoryOptimizer creates a new memory optimizer
func (*MemoryOptimizer) GetConfig ¶
func (o *MemoryOptimizer) GetConfig() *MemoryOptimizerConfig
GetConfig returns the configuration for the memory optimizer
func (*MemoryOptimizer) GetLastOptimizationTime ¶
func (o *MemoryOptimizer) GetLastOptimizationTime() time.Time
GetLastOptimizationTime returns the time of the last optimization
func (*MemoryOptimizer) GetMemoryProfiler ¶
func (o *MemoryOptimizer) GetMemoryProfiler() *profiling.MemoryProfiler
GetMemoryProfiler returns the memory profiler
func (*MemoryOptimizer) GetMemorySavings ¶
func (o *MemoryOptimizer) GetMemorySavings() map[string]float64
GetMemorySavings returns the memory savings for templates
func (*MemoryOptimizer) GetOptimizationCount ¶
func (o *MemoryOptimizer) GetOptimizationCount() int64
GetOptimizationCount returns the number of optimization operations
func (*MemoryOptimizer) GetOptimizedSizes ¶
func (o *MemoryOptimizer) GetOptimizedSizes() map[string]int
GetOptimizedSizes returns the sizes of optimized templates
func (*MemoryOptimizer) GetStats ¶
func (o *MemoryOptimizer) GetStats() *MemoryOptimizerStats
GetStats returns statistics for the memory optimizer
func (*MemoryOptimizer) GetTemplateSizes ¶
func (o *MemoryOptimizer) GetTemplateSizes() map[string]int
GetTemplateSizes returns the sizes of templates
func (*MemoryOptimizer) OptimizeTemplate ¶
OptimizeTemplate optimizes a template for memory usage
func (*MemoryOptimizer) OptimizeTemplates ¶
func (o *MemoryOptimizer) OptimizeTemplates(templates []*format.Template) ([]*format.Template, error)
OptimizeTemplates optimizes multiple templates for memory usage
func (*MemoryOptimizer) SetConfig ¶
func (o *MemoryOptimizer) SetConfig(config *MemoryOptimizerConfig)
SetConfig sets the configuration for the memory optimizer
type MemoryOptimizerConfig ¶
type MemoryOptimizerConfig struct {
// EnableTemplateDeduplication enables template deduplication
EnableTemplateDeduplication bool
// EnableSectionDeduplication enables section deduplication
EnableSectionDeduplication bool
// EnableVariableOptimization enables variable optimization
EnableVariableOptimization bool
// EnableContentCompression enables content compression
EnableContentCompression bool
// EnableLazyLoading enables lazy loading of templates
EnableLazyLoading bool
// EnableInheritanceFlattening enables inheritance flattening
EnableInheritanceFlattening bool
// MaxInheritanceDepth is the maximum inheritance depth
MaxInheritanceDepth int
// EnableGarbageCollectionHints enables garbage collection hints
EnableGarbageCollectionHints bool
// GCInterval is the interval between garbage collections
GCInterval time.Duration
// MemoryThreshold is the memory threshold for optimization (in MB)
MemoryThreshold int64
// EnablePooling enables object pooling
EnablePooling bool
// PoolSize is the size of the object pool
PoolSize int
// EnableBufferReuse enables buffer reuse
EnableBufferReuse bool
// BufferSize is the size of reused buffers
BufferSize int
// EnableStringInterning enables string interning
EnableStringInterning bool
}
MemoryOptimizerConfig represents configuration for the memory optimizer
func DefaultMemoryOptimizerConfig ¶
func DefaultMemoryOptimizerConfig() *MemoryOptimizerConfig
DefaultMemoryOptimizerConfig returns default configuration for the memory optimizer
type MemoryOptimizerStats ¶
type MemoryOptimizerStats struct {
// TemplatesOptimized is the number of templates optimized
TemplatesOptimized int64
// SectionsOptimized is the number of sections optimized
SectionsOptimized int64
// VariablesOptimized is the number of variables optimized
VariablesOptimized int64
// BytesSaved is the number of bytes saved
BytesSaved int64
// MemoryReduced is the amount of memory reduced (in MB)
MemoryReduced float64
// OptimizationTime is the total time spent on optimization
OptimizationTime time.Duration
// GarbageCollections is the number of garbage collections triggered
GarbageCollections int64
// DuplicatesRemoved is the number of duplicates removed
DuplicatesRemoved int64
// StringsInterned is the number of strings interned
StringsInterned int64
// BuffersReused is the number of buffers reused
BuffersReused int64
// ObjectsPooled is the number of objects pooled
ObjectsPooled int64
}
MemoryOptimizerStats tracks statistics for the memory optimizer