-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retire multiple definition of weight
in oasis
#348
Comments
The definition in Here is the plan:
type RankedPlaceInfo struct {
PlaceInfo
Weight *common.Weight
}
// PlaceInfo records place related information such as ID and location
type PlaceInfo struct {
ID PlaceID
Location *nav.Location
} |
Thinking about whether to record as // For definition like
type RankedPlaceInfo struct {
PlaceInfo
Weight *common.Weight
}
// PlaceInfo records place related information such as ID and location
type PlaceInfo struct {
ID PlaceID
Location *nav.Location
}
// and for function return value
RankPlaceIDsByShortestDistance(center nav.Location, targets []*common.PlaceInfo) []*common.RankedPlaceInfo Method Receiver(a structA) or (a *structA) From method's perspective, from Go's method receiver: Pointer vs Value
MemberBut for struct members, I consider more about how to use them. For example,
And we might copy location data in the following process. Making a copy of a struct in Go
Consider that lots of places will hold place's location, from Return valueFor the following case, whether to return a slice of RankPlaceIDsByShortestDistance(center nav.Location, targets []*common.PlaceInfo) []*common.RankedPlaceInfo slice returns pointers, whether the slice is OthersUsing |
For simplicity, the implementation in 1328354 records all kind combination of locations in memory. After this commit, memory increased from 3GB to 7.5GB, but performance go from 40 seconds to 10 seconds. More information could go to here: #349 (comment) More memory optimization would go to next round. |
subtask of #344
package connectivitymap
package stationfindertype
package connectivitymap
package spatialindexer
package stationgraph
The text was updated successfully, but these errors were encountered: