{"action":"created","issue":{"url":"https://api.github.com/repos/qgis/QGIS/issues/2859","repository_url":"https://api.github.com/repos/qgis/QGIS","labels_url":"https://api.github.com/repos/qgis/QGIS/issues/2859/labels{/name}","comments_url":"https://api.github.com/repos/qgis/QGIS/issues/2859/comments","events_url":"https://api.github.com/repos/qgis/QGIS/issues/2859/events","html_url":"https://github.com/qgis/QGIS/pull/2859","id":137842522,"number":2859,"title":"[Improvement] QgsGeos uses GEOSGeometry member of QgsGeometry","user":{"login":"ahuarte47","id":5576272,"avatar_url":"https://avatars.githubusercontent.com/u/5576272?v=3","gravatar_id":"","url":"https://api.github.com/users/ahuarte47","html_url":"https://github.com/ahuarte47","followers_url":"https://api.github.com/users/ahuarte47/followers","following_url":"https://api.github.com/users/ahuarte47/following{/other_user}","gists_url":"https://api.github.com/users/ahuarte47/gists{/gist_id}","starred_url":"https://api.github.com/users/ahuarte47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahuarte47/subscriptions","organizations_url":"https://api.github.com/users/ahuarte47/orgs","repos_url":"https://api.github.com/users/ahuarte47/repos","events_url":"https://api.github.com/users/ahuarte47/events{/privacy}","received_events_url":"https://api.github.com/users/ahuarte47/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-02T11:03:00Z","updated_at":"2016-03-02T20:49:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/2859","html_url":"https://github.com/qgis/QGIS/pull/2859","diff_url":"https://github.com/qgis/QGIS/pull/2859.diff","patch_url":"https://github.com/qgis/QGIS/pull/2859.patch"},"body":"[QgsGeos](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeos.h#L27) class wraps the [QgsGeometryEngine](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometryengine.h#L26) interface of a [QgsAbstractGeometryV2](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsabstractgeometryv2.h#L39) geometry. It is used massively for many spatial functions ([IsGeosValid](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp#L1564), [contains](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp#L821), crosses, intersects....) in [QgsGeometry](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.h#L67).\r\n\r\nBut testing perfomance I see that all operations create in QgsGeos a new [GEOSGeometry](https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeos.cpp#L138) instance from the current QgsGeometry object.\r\n\r\nIt is a performance bottleneck (e.g. labeling), We can test....\r\n\r\n```\r\nQgsGeometry a = ...\r\nQgsGeometry b = ...\r\n\r\nfor (int  i = 0; i < 100; i++)\r\n{\r\n  bool contains = a.contains( &b );\r\n}\r\n```\r\n\r\nThe current code creates 200 GEOSGeometry objects.\r\nI am right ? Is there one reason for this behavior?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/qgis/QGIS/issues/comments/191423802","html_url":"https://github.com/qgis/QGIS/pull/2859#issuecomment-191423802","issue_url":"https://api.github.com/repos/qgis/QGIS/issues/2859","id":191423802,"user":{"login":"ahuarte47","id":5576272,"avatar_url":"https://avatars.githubusercontent.com/u/5576272?v=3","gravatar_id":"","url":"https://api.github.com/users/ahuarte47","html_url":"https://github.com/ahuarte47","followers_url":"https://api.github.com/users/ahuarte47/followers","following_url":"https://api.github.com/users/ahuarte47/following{/other_user}","gists_url":"https://api.github.com/users/ahuarte47/gists{/gist_id}","starred_url":"https://api.github.com/users/ahuarte47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahuarte47/subscriptions","organizations_url":"https://api.github.com/users/ahuarte47/orgs","repos_url":"https://api.github.com/users/ahuarte47/repos","events_url":"https://api.github.com/users/ahuarte47/events{/privacy}","received_events_url":"https://api.github.com/users/ahuarte47/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T20:49:48Z","updated_at":"2016-03-02T20:49:48Z","body":"Thanks Mathias, I see it. Sorry, I precipitated myself doing this work, I did not search if there is already work done. I think to close my pull is better to avoid new noise. Do you agree?\r\n"}}