Speeding up to 120x
michelinok opened this issue · comments
Hi!
I'm not able to create a pull request so i'll put my changes here...
I've found a way to speedup the pareser up to 120x (tested on 5.000 records inside an adif).
Just to these in adif_parser.php:
Mods are self-explaining and very easy
public function load_from_file($fname) //allows the user to accept a filename as input
{
file_put_contents($fname, str_replace("<EOR>", "<eor>", file_get_contents($fname))); //mod
$this->data = file_get_contents($fname);
}
public function get_record()
{
if($this->i >= strlen($this->data))
{
return array(); //return nothing
};
$end = strpos($this->data, "<eor>", $this->i); //mod
if($end == false) //is this the end?
{
return array(); //return nothing
};
$record = substr($this->data, $this->i, $end-$this->i);
$this->i = $end+5;
return $this->record_to_array($record); //process and return output
}
'73 de IU5HES op. Michele Costantino
PS: Before the mod, it takes up to 20 mins and with the mod it takes just 15 seconds to load all of my qsos
'73 de IU5HES op. Michele Costantino
PS: Before the mod, it takes up to 20 mins and with the mod it takes just 15 seconds to load all of my qsos
Just saw this, not sure why I didn't get a notification about this. What's preventing you from making a pull request - something in Github? I'm happy to make you a contributor to the project if that helps.
Just saw this, not sure why I didn't get a notification about this. What's preventing you from making a pull request - something in Github? I'm happy to make you a contributor to the project if that helps.
I'm simply too silly in using github to push new code :P
Feel free (if interested) in pushing the new code (really got 120x improvement in speed).
Many thanks
Mike IU5HES
Thanks. i think I added the change. Check out the file. Just out of curiosity what are you using this for? We haven't used it in several years because we haven't done any new special event stations.