benrr101 / node-taglib-sharp

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

poor performance when saving picture #94

Closed subframe7536 closed 9 months ago

subframe7536 commented 12 months ago

former issue: #71

I finally reuse testStream.ts to implement IStream, but when save picture to large audio file, the write implemention is signaficantly slow in https://github.com/benrr101/node-taglib-sharp/blob/a7acf237c04e748bb773e4614b0a0add09804378/test-unit/utilities/testStream.ts#L76

image same audio file (7.13 MB) and image (14 KB or 1.68 MB perform the same), larger file cost more time

Maybe caused by buffer allocation? Is there any way to fix that?

subframe7536 commented 12 months ago

after scaling the size in const buffer = new Uint8Array(File.bufferSize);, the performance is improved

benrr101 commented 11 months ago

Yeah teststream.ts is meant to be a really quick and dirty implementation of IStream to facilitate unit testing. It's only used for reading small snippet "files" from memory. As such, performance is expected to be pretty bad.

subframe7536 commented 11 months ago

so would you accept a PR that increase the buffer size?