Shapely 1.8.5 中文文档

  1. 主页
  2. 文档
  3. Shapely 1.8.5 中文文档
  4. User Manual
  5. Performance(性能)

Performance(性能)

Shapely uses the GEOS library for all operations. GEOS is written in C++ and used in many applications and you can expect that all operations are highly optimized. The creation of new geometries with many coordinates, however, involves some overhead that might slow down your code.

Shapely使用GEOS库来完成所有操作。GEOS是用C++编写的,并在许多应用程序中使用,你可以期望所有的操作都被高度优化。然而,创建具有许多坐标的新几何要素涉及一些开销,可能会减慢代码运行速度。

New in version 1.2.10.

The shapely.speedups module contains performance enhancements written in C. They are automatically installed when Python has access to a compiler and GEOS development headers during installation.

shapely.speedups模块包含了用C语言编写的性能增强功能,在安装过程中,当Python能够访问编译器和GEOS开发头文件时,会被自动安装。

You can check if the speedups are installed with the available attribute. To enable the speedups call enable(). You can revert to the slow implementation with disable().

你可以通过available属性检查加速器是否已经安装。要启用加速器,请调用enable()。可以调用disable()恢复到慢速执行。

>>> from shapely import speedups
>>> speedups.available
True
>>> speedups.enable()

New in version 1.6.0.

Speedups are now enabled by default if they are available. You can check if speedups are enabled with the enabled attribute.

如果加速器可用的话,现在默认是启用的。你可以用enabled属性检查加速器是否被启用。

>>> from shapely import speedups
>>> speedups.enabled
True
标签 ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here