Comments (6)
I think there's room for improvement, but it's not immediate. Is a process of change + bench, change + bench. Feel free to try to do some experiments and report back. I don't have the time to do it.
from js-spark-md5.
For the ArrayBuffer mode (FileReader.readAsArrayBuffer), why the append method needs to do the toutf8 converting with if(/[u0080-uffff]/.test(str)) { unescape(encodeURIComponent(str)) }. If I understand correctly, this will convert a byte (which is not in the range of the readable character) into something else. This looks consuming a lot of cpu. Can the "appendBinary" method be called directly instead of this "append" method? However, the hash calculating will call substring method. Will the hash rely on that the input is string? Thanks ahead for shedding some lights on this.
from js-spark-md5.
For the toutf8 method, the comment means the input will be converted if it is string. However, the implementation as shown below is to convert the byte array into something else if it is NOT string.
if (/[\u0080-\uFFFF]/.test(str)) {
str = unescape(encodeURIComponent(str));
}
from js-spark-md5.
If you are using FileReader.readAsArrayBuffer, you should be using https://github.com/satazor/SparkMD5#sparkmd5arraybufferappendarr which does not do any conversion.
from js-spark-md5.
Thank you for the explanation. I wrongly missed the ArrayBuffer.prototype.append method.
from js-spark-md5.
Performance was improved by #41. Feel free to reopen this if necessary.
from js-spark-md5.
Related Issues (20)
- Streams HOT 3
- Different md5 for the same file HOT 6
- License issue HOT 4
- Speed comparison to js-md5 HOT 2
- Demo link problem
- Provide functionality for calculating MD5 hashes of files HOT 3
- Array buffer allocation failed
- Seems like it doesn't work in Edge for cyrillic symbols HOT 2
- spark.end(); The results after two executions are different HOT 2
- No tag or release for 3.0.1 HOT 2
- MD5 Computed In IE11 Not Steady HOT 1
- IE10 compute file md5 failed
- Is there a sample implementation for react native expo? HOT 1
- in IE is error HOT 1
- md5 error ( d41d8cd98f00b204e9800998ecf8427e for all big files than 600M) HOT 1
- Fix deprecated unescape
- Provide ESM build HOT 5
- Uncaught TypeError: Cannot read properties of undefined (reading 'ArrayBuffer')
- URIError: malformed URI sequence HOT 1
- 超大体积文件多线程计算 HOT 2
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 js-spark-md5.