mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Robust change detection: replaced string concat with struct-based compare in hasModelMappingsChanged; removed boolTo01.
• Performance: pre-allocate map and regex slice capacities in UpdateMappings. • Verified with amp module tests (all passing)
This commit is contained in:
@@ -91,8 +91,8 @@ func (m *DefaultModelMapper) UpdateMappings(mappings []config.AmpModelMapping) {
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Clear and rebuild mappings
|
||||
m.mappings = make(map[string]string)
|
||||
m.regexps = m.regexps[:0]
|
||||
m.mappings = make(map[string]string, len(mappings))
|
||||
m.regexps = make([]regexMapping, 0, len(mappings))
|
||||
|
||||
for _, mapping := range mappings {
|
||||
from := strings.TrimSpace(mapping.From)
|
||||
|
||||
Reference in New Issue
Block a user