gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] Re: Bitwise stream reading performance


From: strk
Subject: [Gnash-dev] Re: Bitwise stream reading performance
Date: Sat, 25 Aug 2007 12:35:36 +0200

On Sat, Aug 25, 2007 at 12:05:54PM +0200, Udo Giacomozzi wrote:
> For an introduction to this discussion, see
> http://www.gnashdev.org/wiki/index.php/NinjaProfile
...
> of a local file). Maybe it would be better to implement a 
> internal buffered memory stream (sort of a read-ahead buffer for the
> "stream" class.

Yes, I think we need this.

> Secondly, the read_uint() function masks the used bits after having
> consumed them:
> 
>   m_current_byte &= ((1 << (m_unused_bits - bits_needed)) - 1);
> 
> Maybe it would be faster to leave m_current_byte as-is and mask the
> needed bits when updating "value". Should avoid a write access to
> memory and we don't need masking at all in the "consume all the unused
> bits" case.
> 
> Setting m_current_byte = 0 should be unnecessary, too. And instead of
> setting bits_needed = 0 a "break" would do as well (ok, not very nice,
> but sligtly faster).

I've implemented the optimization above (except for the mask, which I was
thinking about) tonite, and it does give a slight
improvement, but not enough for my taste.. I think a buffered read
would do much better.

--strk;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]