Vector优化后的jpg编码类JPEGEncoder比原来的adobe提供的相同功能的类效率高4倍
类文件JPEGEncoder下载地址:http://www.bytearray.org/wp-content/projects/fastjpeg/JPEGEncoder.as
Here is a little demo (encoding a 2880*2880 BitmapData) showing the difference between the old version and the new one, if you could post your results through the comments that would be interesting :
So what did I do ?
- I used bitwise operators as much as possible.
- I replaced all Arrays with fixed length Vectors.
- I used pre-incrementation rather than post-incrementation (thanks Joa for this one ).
- I casted to int almost all my Vector indices access.
- Other minor stuff you always do to optimize your code