Showing posts with label nmea. Show all posts
Showing posts with label nmea. Show all posts

Monday, December 20, 2010

GPS & Ruby: dealing with performance bottlenecks

About a month ago, I posted about how to convert pure GPS data into Ruby class instances. But as it turned out this converting in general takes more time than processing the data.

For tests I've used 2.7MB .nmea file. It contains about 5 thousand GPRMC sentences from which about 3 thousand contain useful information.

The first version of readNMEA function takes about 0.87 seconds (on my Asus EeePC 1001P) to make an array of GPRMC class instances. How can we improve that?

Firstly, access to the elements of an array (by index) is faster than access to the elements of a hash (by key). Thus using old-style regular expressions decreases the time from 0.87 to 0.72 seconds:

Saturday, November 13, 2010

GPS & Ruby: Introduction

This is the beginning of post series devoted to playing with data obtained by a GPS receiver. Here I assume that you are familiar with basic concepts of object-oriented programming and also assume that you don't know Ruby (honestly, neither do I, but that's gonna change eventually). So don't you worry, there will be a few comments about the code ;-)

In this post I'm gonna acquaint you with the NMEA format used in GPS receivers. Actually, you can read about that in details here, for example. In fact, it's a proprietary one but it's too old to not to be reverse-engineered :-)

We're gonna use just one type of NMEA sentence, namely GPRMC.