Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

mapbox cost too much cpu

未關閉
#1,086 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
20/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
java
領域
performance

研究方向

從提供的 inRing 方法和用於 100,000 多個城市的 PointCustom 清單開始;檢查其呼叫路徑,並在每秒 100 個請求的情況下對工作負載進行效能分析。將完成定義為保留位置結果,同時證明在可比較的生產環境負載下 CPU 使用率更低。

由索引模型根據 Issue 內容生成。

描述

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?

主要語言
Java
星號
438
分支
117
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

mapbox/mapbox-java 的其他 Issue

查看 mapbox/mapbox-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。