mapbox cost too much cpu
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 438
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
I overwrite the code like here:
public static boolean inRing(PointCustom pt, List<PointCustom> pointCustomList) {
boolean isInside = false;
for (int i = 0, j = pointCustomList.size() - 1; i < pointCustomList.size(); j = i++) {
double xi = pointCustomList.get(i).getLongitude();
double yi = pointCustomList.get(i).getLatitude();
double xj = pointCustomList.get(j).getLongitude();
double yj = pointCustomList.get(j).getLatitude();
boolean intersect = (
(yi > pt.getLatitude()) != (yj > pt.getLatitude()))
&& (pt.getLongitude() < (xj - xi) * (pt.getLatitude() - yi) / (yj - yi) + xi);
if (intersect) {
isInside = !isInside;
}
}
return isInside;
}
but i run it on the production.and find that the cpu of server cost too much ,200% CPU is consumed frequently when send 100 requests per second.
My demand is to locate in the longitude and latitude data of 100000 cities through longitude and latitude。
And the args of varible : pointCustomList storage 100000+ CityInfo object.
What problem can reduce the cost of CPU?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided inRing method and the PointCustom list used for 100,000+ cities; inspect its call path and profile the workload at 100 requests per second. Define completion as preserving the location results while demonstrating lower CPU usage under a comparable production-like load.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100