Hi everybody, after hearing about the new Sound functionality in Flash 10, Arek's performance gain using the new Vector type instead of Array and not at least actually seeing the performance boost he achieved compared to my old Vorbis decoder, I found a few hours yesterday to migrate my old code. First of all: the new PCM playback API for Flash is rather restricted and only allows 44.1 ksps, stereo. Implementing a generic Vorbis player for Flash would still require a software resampler between the decoder and the playback engine, but I guess most streams are encoded with those parameters anyway. Good news is at least that the new API seem to be much less critical to timing issues compared to the hack I used in the previous player, so it should be much easier now to operate the player together with a user interface. Second: replacing Array with Vector simplified the code to some extent, but I am not able to measure any particular performance gain. I am not sure, but it looks almost to me as if the haXe compiler is producing much more efficient Flash bytecode compared to the Adobe AS compiler. I haven't bothered verifying this, but I've profiled my code and there is no "hotspot" where I'm doing something obviously wrong. Time divides between the components in almost the same manner as with my Java decoder, e.g. roughly 40% of the time is spent in the iMDCT code, 35-40% decoding floors and residues and most of the remainer is probably the Huffman code. New attempt (requiring Flash 10 beta player): http://flash.j-ogg.de/10/ Old player: http://flash-j-ogg.de/ Can someone verify that the new player actually causes slightly more CPU load than the old player, or is it just my eyes fooling me? Tor
On Tue, Oct 7, 2008 at 11:17 AM, Tor-Einar Jarnbjo <tor-einar at jarnbjo.name> wrote:> New attempt (requiring Flash 10 beta player): > > http://flash.j-ogg.de/10/ > > Old player: > > http://flash-j-ogg.de/ > > Can someone verify that the new player actually causes slightly more CPU > load than the old player, or is it just my eyes fooling me?I can confirm it. Around 10% difference. Tested on OS X, Flashplayer 10 Beta in Safari.
Hi, On Tue, Oct 7, 2008 at 11:17 AM, Tor-Einar Jarnbjo <tor-einar at jarnbjo.name> wrote:> First of all: the new PCM playback API for Flash is rather restricted > and only allows 44.1 ksps, stereo. Implementing a generic Vorbis player > for Flash would still require a software resampler between the decoderCorrect, same for fvorbis - at the moment it only plays correctly files encoded at 44100 Hz, but I have some experimental ideas how that could be solved...> > Second: replacing Array with Vector simplified the code to some extent, > but I am not able to measure any particular performance gain. I am not > sure, but it looks almost to me as if the haXe compiler is producing > much more efficient Flash bytecode compared to the Adobe AS compiler. IIn my experience that's been the case since the mtasc times - most of the time it does produce more efficient bytecode than Macromedia / Adobe tools.> > New attempt (requiring Flash 10 beta player): > > http://flash.j-ogg.de/10/ > > Old player: > > http://flash-j-ogg.de/ > > Can someone verify that the new player actually causes slightly more CPU > load than the old player, or is it just my eyes fooling me?On my machine the Flash 9 version seems to be about 1.5-3.5 times slower than fvorbis. The new v10 demo hangs my browser (with flash player plugin version 10,0,0,525 release) every time I try. It looks like you almost completely changed from using Array to Vectors. In my experiments the attempts to parametrize Vector with anything else than int, uint, Number or Object caused pretty bad performance, plus frequent browser hangs. That might be a bug in the flash player v10 but, being too impatient to wait for confirmation/fix, I ended up using Vectors only for arrays of integers and floats, also resigning from nested/multi-dimensional Vectors as that didn't seem to work properly in the flash player, either. Arek