2.6 KiB
Performance
NeoGPS is 40% to 70% faster.
For comparison, the following sentences were parsed by various Configurations of NeoGPS, TinyGPS and TinyGPSPlus on a 16MHz Arduino Mega2560.
$GPGGA,092725.00,4717.11399,N,00833.91590,E,1,8,1.01,499.6,M,48.0,M,,0*5B
$GPRMC,083559.00,A,4717.11437,N,00833.91522,E,0.004,77.52,091202,,,A*57
$GPGSV,3,1,10,23,38,230,44,29,71,156,47,07,29,116,41,08,09,081,36*7F
$GPGSV,3,2,10,10,07,189,,05,05,220,,09,34,274,42,18,25,309,44*72
$GPGSV,3,3,10,26,82,187,47,28,43,056,46*77
Configuration | Sentence | NeoGPS | TinyGPS Time (% faster) | TinyGPS++ Time (% faster) | Adafrut_GPS Time (%faster) |
Minimal | GGA RMC | 329us 335us | - (78%) - (77%) | - (78%) - (77%) | |
DTL | GGA RMC | 780us 803us | - (46%) - (44%) | - (47%) - (44%) | |
Nominal | GGA RMC | 864us 883us | 1448us (40%) 1435us (39%) | 1473us (41%) 1442us (39%) | 1358us (36%) 1535us (42%) |
Full | GGA RMC GSV | 908us 899us 2194us | - (37%) - (37%) - (-) | 1523us (40%) 1560us (42%) 6651us (67%) |
Why is NeoGPS faster?
Most libraries use extra buffers to accumulate parts of the sentence so they
can be parsed all at once. For example, an extra field buffer may hold on
to all the characters between commas. That buffer is then parsed into a
single data item, like heading
. Some libraries even hold on to the
entire sentence before attempting to parse it. In addition to increasing
the RAM requirements, this requires extra CPU time to copy the bytes and
index through them... again.
NeoGPS parses each character immediately into the data item. When the delimiting comma is received, the data item has been fully computed in place and is marked as valid.
Most libraries parse all fields of their selected sentences. Although most people use GPS for obtaining lat/long, some need only time, or even just one pulse-per-second.
NeoGPS configures each item separately. Disabled items are conditionally compiled, which means they will not use any RAM, program space or CPU time. The characters from those fields are simply skipped; they are never copied into a buffer or processed.
While it is significantly faster and smaller than all NMEA parsers, these same improvements also make NeoGPS faster and smaller than binary parsers.