maptalks / proj4m

proj4 minimal/maptalks
MIT License
26 stars 6 forks source link

增加新的接口, 减少数据转换 #9

Closed wsw0108 closed 6 years ago

wsw0108 commented 6 years ago

通过定义接口, 来兼容其他类Point类型. 参考:

wsw0108 commented 6 years ago

https://github.com/wsw0108/benchmarks/blob/master/src/main/java/org/maptalks/benchmark/proj4/Proj4mBenchmark.java 未见(明显)性能提升

fuzhenn commented 6 years ago

性能虽然没提升,但避免了不少double[]的创建,应能改善GC,感觉值得修改

wsw0108 commented 6 years ago

@fuzhenn 虽然避免了double[]的创建, 但交换条件是forward/inverse只能修改传入的Point类对象. 在泛型里, 根据Java规范, 是没法如下的:

public class Klass<T> {
  public T newInstance() {
    return new T; // error
  }
}