Comments (7)
Updated by mikechambers on 2008-07-02T16:46:25
Added label HasAPatch
Original ticket set status to Accepted (we converted to open)
from as3corelib.
Updated by mikechambers on 2008-07-02T22:30:53
Change createBlocks to use array reference instead of s.getCharCodeAt()
Can you explain this change?
Also, have you done any performance test on hashing strings between the existing
implementation, and yours?
Original ticket set status to NeedMoreInfo (we converted to open)
from as3corelib.
Updated by marklynch on 2008-07-04T14:37:26
Hi Mike,
Change createBlocks to use array reference instead of s.getCharCodeAt()
As the createBlocks now takes a byteArray instead of a string, I'm using direct array
notation to get the values instead of using the original s.getCharCodeAt();
Was:
blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( i % 32 );
Now this:
blocks[ i >> 5 ] |= ( s[ i / 8 ] & mask ) << ( i % 32 );
Re benchmarking - I hadn't done any, but I have now.
Initially it was slower than the original version by approx 13%.
I optimised it a bit and now it runs ever so slightly faster than the original one
(about 4% faster)
This is the optimisation change, removed this code (in function hash):
for(var i:int = 0; i
from as3corelib.
Updated by marklynch on 2008-07-04T14:43:59
Mike,
In case you wish to reproduced the benchmarks, here is the code I used is below.
I set up two projects with the corelibs placed in the src folder and ran this with
modified and original versions.
Timings I got were on 3 runs were:
Original: 3865,3722,3809, AVG 3799
Patched 1: 4413,4314,4140 AVG 4289
Patched 2: 3625,3561,3797 AVG 3661
Code snippet:
package {
import com.adobe.crypto.MD5;
import flash.display.Sprite;
import flash.utils.getTimer;
public class md5benchOrig extends Sprite
{
public function md5benchOrig()
{
var string:String = "asda asd da da da dasd a dasd asdasdadadad a dasda asd da
da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda
asd da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad
a dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd
asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da
dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda asd
da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a
dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd
asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da
dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda asd
da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a
dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd
asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dasda asd da da da
dasd a dasd asdasdadadad a dasda asd da da da dasd a dasd asdasdadadad a dv";
var hashed:String = "";
var startTime:uint = getTimer();
for(var i:int; i < 1000; i++){
hashed = MD5.hash(string);
}
var elapsedTime:uint = getTimer() - startTime;
trace(hashed);
trace('Time taken: ' + elapsedTime);
}
}
}
from as3corelib.
Updated by mikechambers on 2008-07-06T20:30:23
I have checked in the changes (revision 49).
Could someone post a simple test case / cases for hashBinary? ill add them to the
test suite.
from as3corelib.
Updated by mikechambers on 2008-07-06T20:30:38
Removed label Type-Defect
Added label Type-Enhancement
from as3corelib.
Updated by mikechambers on 2008-11-07T19:28:07
Original ticket set status to Fixed (we converted to closed)
from as3corelib.
Related Issues (20)
- URI.isDirectory is broken
- Fat SWC for better code completion
- library is incompatible with Flash Builder 4.5 HOT 6
- Getting error while running example on win7/FB451 and Flashplayer 10
- Error parsing JSON: Unexpected end of input - Comments
- MD5.digest.endian should be LITTLE_ENDIAN(patch included)
- Include SWC in git HOT 3
- the JSON class conflicts with the Native JSON class for FlashPlayer 11 HOT 2
- The HMAC-SHA1 signature generated is different for Ubuntu JAUNTY
- JSONEncoder.objectToString() fails when the object has "internal" property
- JSON.decode undefined method HOT 3
- URI should use escape/unescape (ascii) as opposed to encode/decodeURI (UTF8)
- StringUtil
- JSONencode can't change output names
- JSON class not working when exporting to AIR — #1065: Variable JSON is not defined HOT 1
- importing JPGEncoder
- URI breaks query strings containing `=` symbol
- SHA set int var with number > int.MAX_VALUE
- Base64Encoder DOES NOT WORK WITH FLASH PROFESSIONAL OR ANIMATE CC
- [Bug] JPGEncoder.encode problem with loaded image's bitmap data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from as3corelib.