[MPlayer-dev-eng] [PATCH] Parsing simplification in vobsub

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Apr 13 21:37:24 CEST 2010


On Tue, Apr 13, 2010 at 03:22:04PM +0200, ubitux wrote:
> On Tue, Apr 13, 2010 at 08:00:45AM +0200, Reimar Döffinger wrote:
> > On Tue, Apr 13, 2010 at 04:54:58AM +0200, ubitux wrote:
> > > Are you interested in that kind of patches? The attached patch shows a
> > > simpler way of parsing timestamp/filepos lines. I can also do it for
> > > parse_origin and parse_id, but I'd like to know if this can be accepted.
> > 
> > Needs some speed testing, sscanf is _incredibly_ slow, making this code about
> > 10x slower can be quite an issue.
> 
> Well, sure it's slower, but not 10x. This is what I got with the bench
> file in attachment:
> 
> % ./a.out
> manual: 2004721 us
> sscanf: 5793554 us

If I interpret this correctly, I think this means that MPlayer startup time
will increase from 2 to nearly 6 seconds.
As much as I'd like your cleaner code, that seems not acceptable.
However if you're still interested, I think you could replace the isdigit loop
and atoi by strtol and it probably would be faster.
Replacing the while + isspace by strcspn probably would be possible, more
readable and faster as well.



More information about the MPlayer-dev-eng mailing list