Improvements: * floating point operations are approx 4x's faster * Now write quiet NaN's * all read/write on floating point now done in C, so no more need for lib/buffer_ieee754.js * float values have more accurate min/max value checks * add additional benchmarks for buffers read/write * created benchmark/_bench_timer.js which is a simple library that can be included into any benchmark and provides an intelligent tracker for sync and async tests * add benchmarks for DataView set methods * add checks and tests to make sure offset is greater than 0
Remove a lot of branches from the inner loop. Speeds up buf.toString('base64') by about 20%. Before: $ time out/Release/node benchmark/buffer-base64-encode.js real 0m6.607s user 0m5.508s sys 0m1.088s After: $ time out/Release/node benchmark/buffer-base64-encode.js real 0m5.520s user 0m4.520s sys 0m0.992s
Throw, don't abort. `new Buffer(0x3fffffff + 1)` used to bring down the process with the following error message: FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length exceeds max acceptable value Fixes #2280.
It was decided that the performance benefits that isolates offer (faster spin-up times for worker processes, faster inter-worker communication, possibly a lower memory footprint) are not actual bottlenecks for most people and do not outweigh the potential stability issues and intrusive changes to the code base that first-class support for isolates requires. Hence, this commit backs out all isolates-related changes. Good bye, isolates. We hardly knew ye.
Honor the length argument in `buf.write(s, 0, buf.length, 'base64')`. Before this commit, the length argument was ignored. The decoder would keep writing until it hit the end of the buffer. Since most buffers in Node are slices of a parent buffer (the slab), this bug would overwrite the content of adjacent buffers. The bug is trivially demonstrated with the following test case: var assert = require('assert'); var a = Buffer(3); var b = Buffer('xxx'); a.write('aaaaaaaa', 'base64'); assert.equal(b.toString(), 'xxx'); This commit coincidentally also fixes a bug where Buffer._charsWritten was not updated for zero length buffers.