Refactor Priority Reduce functions
- Reducing the duplicated reduce function by introducing a reduce function generator that generates common reduce functions. - Remove logs from reduce function, so it's purely calculating scores. - Optimize the reduce functions by removing unnecessary conversion to float64.
This commit is contained in:
@@ -429,12 +429,14 @@ func getPriorityFunctionConfigs(names sets.String, args PluginFactoryArgs) ([]al
|
||||
}
|
||||
if factory.Function != nil {
|
||||
configs = append(configs, algorithm.PriorityConfig{
|
||||
Name: name,
|
||||
Function: factory.Function(args),
|
||||
Weight: factory.Weight,
|
||||
})
|
||||
} else {
|
||||
mapFunction, reduceFunction := factory.MapReduceFunction(args)
|
||||
configs = append(configs, algorithm.PriorityConfig{
|
||||
Name: name,
|
||||
Map: mapFunction,
|
||||
Reduce: reduceFunction,
|
||||
Weight: factory.Weight,
|
||||
|
||||
Reference in New Issue
Block a user