Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Speaking as the author of Geo-Distance-XS, I consider it to be actively developed. Even though Geo-Distance might be considered decommissioned by it's author, he probably will accept patches via its github repo. As will I for Geo::Distance::XS at its its repo.

A good reason to use Geo::Distance::XS:

---- [ Formula: hsin ] ------------------------------------ perl - distance from BWI to LAX: 2324.06319758555 miles xs - distance from BWI to LAX: 2324.06319758555 miles gis::fast - distance from BWI to LAX: 2324.06319758555 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 1 wallclock secs ( 1.05 usr + 0.01 sys = 1.06 CPU) @ 23 +866.04/s (n=25298) perl: 1 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 78 +019.05/s (n=81920) xs: 2 wallclock secs ( 1.12 usr + -0.01 sys = 1.11 CPU) @ 12 +45236.94/s (n=1382213) Rate gis::fast perl xs gis::fast 23866/s -- -69% -98% perl 78019/s 227% -- -94% xs 1245237/s 5118% 1496% -- ---- [ Formula: polar ] ------------------------------------ perl - distance from BWI to LAX: 2652.59252292455 miles xs - distance from BWI to LAX: 2652.59252292455 miles gis::fast - distance from BWI to LAX: 2652.59252292455 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 1 wallclock secs ( 1.08 usr + 0.00 sys = 1.08 CPU) @ 18 +962.96/s (n=20480) perl: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 80 +736.45/s (n=86388) xs: 2 wallclock secs ( 1.14 usr + 0.00 sys = 1.14 CPU) @ 15 +09051.75/s (n=1720319) Rate gis::fast perl xs gis::fast 18963/s -- -77% -99% perl 80736/s 326% -- -95% xs 1509052/s 7858% 1769% -- ---- [ Formula: cos ] ------------------------------------ perl - distance from BWI to LAX: 2324.06319758555 miles xs - distance from BWI to LAX: 2324.06319758555 miles gis::fast - distance from BWI to LAX: 2324.06319758555 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 23 +642.99/s (n=25298) perl: 1 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @ 77 +282.08/s (n=81919) xs: 0 wallclock secs ( 1.00 usr + 0.00 sys = 1.00 CPU) @ 13 +10719.00/s (n=1310719) Rate gis::fast perl xs gis::fast 23643/s -- -69% -98% perl 77282/s 227% -- -94% xs 1310719/s 5444% 1596% -- ---- [ Formula: gcd ] ------------------------------------ perl - distance from BWI to LAX: 0 miles xs - distance from BWI to LAX: 2324.06319758555 miles gis::fast - distance from BWI to LAX: 0 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 18 +270.09/s (n=19549) perl: 2 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 73 +080.37/s (n=78196) xs: 1 wallclock secs ( 1.05 usr + 0.01 sys = 1.06 CPU) @ 12 +98354.72/s (n=1376256) Rate gis::fast perl xs gis::fast 18270/s -- -75% -99% perl 73080/s 300% -- -94% xs 1298355/s 7006% 1677% -- ---- [ Formula: mt ] ------------------------------------ perl - distance from BWI to LAX: 2324.06319758555 miles xs - distance from BWI to LAX: 2324.06319758555 miles gis::fast - distance from BWI to LAX: 2324.06319758555 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 1 wallclock secs ( 1.12 usr + 0.01 sys = 1.13 CPU) @ 17 +300.00/s (n=19549) perl: 1 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @ 67 +621.70/s (n=71679) xs: 2 wallclock secs ( 1.07 usr + 0.01 sys = 1.08 CPU) @ 12 +74311.11/s (n=1376256) Rate gis::fast perl xs gis::fast 17300/s -- -74% -99% perl 67622/s 291% -- -95% xs 1274311/s 7266% 1784% -- ---- [ Formula: tv ] ------------------------------------ perl - distance from BWI to LAX: 2328.95218785171 miles xs - distance from BWI to LAX: 2324.51147636132 miles gis::fast - distance from BWI to LAX: 2328.95218785171 miles Benchmark: running gis::fast, perl, xs for at least 1 CPU seconds... gis::fast: 2 wallclock secs ( 1.09 usr + 0.01 sys = 1.10 CPU) @ 21 +720.91/s (n=23893) perl: 1 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @ 16 +439.45/s (n=17919) xs: 2 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 77 +1011.43/s (n=809562) Rate perl gis::fast xs perl 16439/s -- -24% -98% gis::fast 21721/s 32% -- -97% xs 771011/s 4590% 3450% --
Benchmarking script:
#!/usr/bin/env perl use strict; use warnings; use Benchmark qw(cmpthese timethese); use Geo::Distance::XS; use GIS::Distance; # When benchmarking, need to have it call import/unimport before the # code is executed. my $orig_timethis_sub = \&Benchmark::timethis; { no warnings 'redefine'; *Benchmark::timethis = sub { my $sub = ('perl' eq $_[2] ? 'un' : '') . 'import'; Geo::Distance::XS->$sub(); $orig_timethis_sub->(@_); }; } # Lon, Lat my @coord = (-76.668851, 39.179689, -118.408618, 33.943532); my $geo = Geo::Distance->new; my $gis = GIS::Distance->new; my %gis_formula = ( hsin => 'Haversine', polar => 'Polar', cos => 'Cosine', gcd => 'GreatCircle', mt => 'MathTrig', tv => 'Vincenty', ); sub geo { my $d = $geo->distance(mile => @coord); } sub gis { my $d = $gis->distance(@coord[ 1, 0, 3, 2 ]); return $d->mile; } for my $formula (qw(hsin polar cos gcd mt tv)) { print "---- [ Formula: $formula ] -------------------------------- +----\n"; $geo->formula($formula); $gis->formula($gis_formula{$formula}); Geo::Distance::XS->unimport; printf "perl - distance from BWI to LAX: %s miles\n", geo(); Geo::Distance::XS->import; printf "xs - distance from BWI to LAX: %s miles\n", geo(); printf "gis::fast - distance from BWI to LAX: %s miles\n", gis(); print "\n"; my $benchmarks = timethese - 1, { perl => \&geo, xs => \&geo, 'gis::fast' => \&gis, }; cmpthese $benchmarks; print "\n"; }

In reply to Re: Alternatives To Geo::Distance by gray
in thread Alternatives To Geo::Distance by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found