Skip to content
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

Refactor: Performance tune for OASIS service #353

Merged
merged 11 commits into from
May 28, 2020
Merged

Conversation

CodeBear801
Copy link

@CodeBear801 CodeBear801 commented May 28, 2020

Issue

Description

This pull improves performance for OASIS service for about 10 times. For more details please go to #345 and #349.
During performance tune and refactoring, I noticed there are some further work to be done:

Tasklist

Pre-requirements

  • Want to contribute? Great! First, please read this page Contribution Guidelines.
  • If your PR is still work in progress please attach the relevant label.

@CodeBear801 CodeBear801 added the Refactor Rewrite existing code in order to improve its readability, reusability or structure label May 28, 2020
@CodeBear801 CodeBear801 added this to the v10.4.0 milestone May 28, 2020
@CodeBear801 CodeBear801 self-assigned this May 28, 2020
@@ -3,6 +3,7 @@ package connectivitymap
import (
"sync"

"github.com/Telenav/osrm-backend/integration/service/oasis/internal/common"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still common? Aha

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change it to domain/entity :)

func (q *querier) NearByStationQuery(placeID common.PlaceID) []*common.RankedPlaceInfo {
if results, ok := q.id2QueryResults[placeID]; ok {
return results
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove else block.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Remove not necessary else.

@@ -31,36 +31,33 @@ func NewStationGraph(currEnergyLevel, maxEnergyLevel float64, strategy chargings
func (sg *stationGraph) setStartAndEndForGraph(currEnergyLevel, maxEnergyLevel float64) bool {
startLocation := sg.querier.GetLocation(stationfindertype.OrigLocationID)
if startLocation == nil {
glog.Errorf("Failed to find %#v from Querier GetLocation()\n", stationfindertype.OrigLocationID)
glog.Errorf("Failed to find %#v from Querier GetLocation()\n", stationfindertype.OrigLocationID.String())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %s instead, then you don't need to explicitly call String().

Copy link
Author

@CodeBear801 CodeBear801 May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove .String()

@CodeBear801 CodeBear801 merged commit 0b46118 into master May 28, 2020
@CodeBear801 CodeBear801 deleted the feature/profile-oasis branch May 28, 2020 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Rewrite existing code in order to improve its readability, reusability or structure
Projects
None yet
2 participants