Return-Path: X-Original-To: apmail-incubator-sis-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-sis-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 18B5C97B1 for ; Thu, 19 Apr 2012 20:11:04 +0000 (UTC) Received: (qmail 91392 invoked by uid 500); 19 Apr 2012 20:11:04 -0000 Delivered-To: apmail-incubator-sis-commits-archive@incubator.apache.org Received: (qmail 91352 invoked by uid 500); 19 Apr 2012 20:11:03 -0000 Mailing-List: contact sis-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@incubator.apache.org Delivered-To: mailing list sis-commits@incubator.apache.org Received: (qmail 91342 invoked by uid 99); 19 Apr 2012 20:11:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Apr 2012 20:11:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Apr 2012 20:11:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id F04603A4C6F for ; Thu, 19 Apr 2012 20:10:39 +0000 (UTC) Date: Thu, 19 Apr 2012 20:10:39 +0000 (UTC) From: "Peter Karich (Created) (JIRA)" To: sis-commits@incubator.apache.org Message-ID: <1325731623.7248.1334866239986.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (SIS-45) Performance improvement of queryByPointRadius MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Performance improvement of queryByPointRadius --------------------------------------------- Key: SIS-45 URL: https://issues.apache.org/jira/browse/SIS-45 Project: Spatial Information Systems Issue Type: Improvement Reporter: Peter Karich If I didn't make a mistake a search with the normal distance method took ~2.4s and with this distance method it takes only about 0.7s: {code} public static double getHaversineDistance(double fromLat, double fromLon, double toLat, double toLon) { double dLat = Math.toRadians(toLat - fromLat); double dLon = Math.toRadians(toLon - fromLon); double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(fromLat)) * Math.cos(Math.toRadians(toLat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2); return EARTH_RADIUS * 2 * Math.asin(Math.sqrt(a)); } {code} Also one should think about normalizing the distance before the search so that one does not need the whole last line which should give further speed improvements. I'm still unsure why it takes roughly the same time in my example for 10km, 20km and 40kmm where at every step a lot more nodes are involved. Normally I would say the mode nodes - the more comparisons it'll take and the slower it should get. But it doesn't. Probably I'm measuring wrong? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira