benrr101 / node-taglib-sharp

A node.js port of mono/taglib-sharp
GNU Lesser General Public License v2.1
34 stars 9 forks source link

increase buffer size #100

Closed subframe7536 closed 4 months ago

subframe7536 commented 6 months ago

see #94

benrr101 commented 5 months ago

I'm not sure about this change. I can understand that in the case where shuffling all the bytes to the new end of the file could benefit from a larger buffer. But a 1mb buffer is pretty large for some scenarios (eg, an ID3v2 tag at the end of the file is being updated - this may only need a small buffer, allocating 1MB buffer would be wasteful, imho).

How about a compromise. We know how many bytes the file contents need to be shuffled, how about if it's greater than 1MB we use a BUFFER_SIZE * 1024 size, if it's less than 1MB we use BUFFER_SIZE.

subframe7536 commented 5 months ago

Indeed. Now _bufferSize is allocated on demand