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 MemoryConfig
- type MemoryOptimizer
- func (mo *MemoryOptimizer) ClearPools()
- func (mo *MemoryOptimizer) Close() error
- func (mo *MemoryOptimizer) GetFromPool(poolName string) interface{}
- func (mo *MemoryOptimizer) GetMemoryUsage() int64
- func (mo *MemoryOptimizer) GetStats() OptimizationStats
- func (mo *MemoryOptimizer) OptimizeMemory(ctx context.Context) error
- func (mo *MemoryOptimizer) PutToPool(poolName string, obj interface{})
- func (mo *MemoryOptimizer) ResizePool(poolName string, newSize int) error
- func (mo *MemoryOptimizer) SetMaxMemory(maxMemoryMB int64)
- type OptimizationStats
- type TemplateCache
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 MemoryConfig ¶ added in v0.8.0
type MemoryConfig struct {
MaxMemoryMB int64
GCInterval time.Duration
PoolSize int
CacheTimeout time.Duration
EnablePooling bool
}
MemoryConfig configuration for memory optimizer
type MemoryOptimizer ¶
type MemoryOptimizer struct {
// contains filtered or unexported fields
}
MemoryOptimizer handles memory optimization for template processing
func NewMemoryOptimizer ¶
func NewMemoryOptimizer(config MemoryConfig) *MemoryOptimizer
NewMemoryOptimizer creates a new memory optimizer
func (*MemoryOptimizer) ClearPools ¶ added in v0.8.0
func (mo *MemoryOptimizer) ClearPools()
ClearPools clears all object pools
func (*MemoryOptimizer) Close ¶ added in v0.8.0
func (mo *MemoryOptimizer) Close() error
Close shuts down the memory optimizer
func (*MemoryOptimizer) GetFromPool ¶ added in v0.8.0
func (mo *MemoryOptimizer) GetFromPool(poolName string) interface{}
GetFromPool retrieves an object from the specified pool
func (*MemoryOptimizer) GetMemoryUsage ¶ added in v0.8.0
func (mo *MemoryOptimizer) GetMemoryUsage() int64
GetMemoryUsage returns current memory usage in MB
func (*MemoryOptimizer) GetStats ¶
func (mo *MemoryOptimizer) GetStats() OptimizationStats
GetStats returns current optimization statistics
func (*MemoryOptimizer) OptimizeMemory ¶ added in v0.8.0
func (mo *MemoryOptimizer) OptimizeMemory(ctx context.Context) error
OptimizeMemory performs memory optimization
func (*MemoryOptimizer) PutToPool ¶ added in v0.8.0
func (mo *MemoryOptimizer) PutToPool(poolName string, obj interface{})
PutToPool returns an object to the specified pool
func (*MemoryOptimizer) ResizePool ¶ added in v0.8.0
func (mo *MemoryOptimizer) ResizePool(poolName string, newSize int) error
ResizePool resizes a specific pool
func (*MemoryOptimizer) SetMaxMemory ¶ added in v0.8.0
func (mo *MemoryOptimizer) SetMaxMemory(maxMemoryMB int64)
SetMaxMemory updates the maximum memory threshold