Amadeus Pro slow file I/O
Moderator: Martin Hairer
Amadeus Pro slow file I/O
This is an old problem, which I keep hoping will be fixed... Amadeus takes a relatively long time writing and reading from disk. For example, a 500MB wav file takes about 3.5 seconds to write to the internal SSD of a 2020 MacBook Pro. That's about 150 MB/sec, for a drive which is rated and which I benchmark at about 1600 MB/sec; so Amadeus is about 10 times slower than what the drive can do. Can this be fixed easily?
- Martin Hairer
- Site Admin
- Posts: 1976
- Joined: Wed Nov 08, 2006 11:49 am
- Contact:
Re: Amadeus Pro slow file I/O
Chances are that some of that sound data is being stored on disk, so it's a simultaneous read / write rather than a pure write. Also, even though WAV files aren't compressed, the sound data has to be converted from its internal 32-bit floating point representation to the 16 / 24bit integer representation you want for the WAV file.
Re: Amadeus Pro slow file I/O
If I save the file as 32-bit wav it takes about 4.5 seconds to read. Integer to float conversion is pretty fast.
Could file I/O be sped up by reading/writing larger buffers at a time?
Could file I/O be sped up by reading/writing larger buffers at a time?
- Martin Hairer
- Site Admin
- Posts: 1976
- Joined: Wed Nov 08, 2006 11:49 am
- Contact:
Re: Amadeus Pro slow file I/O
You can speed things up by making sure the whole file is read into RAM: increase the "Maximal RAM size" in the advanced preferences to something like 8096. (That's assuming your computer has at least 16GB of RAM, otherwise you may end up swapping, which is actually *less* efficient.) With this, a 650MB 16bit Wave file opens in just under 3 seconds on my 2018 MacBook Pro. Some of that time is spent in the format conversion, but a larger part is actually spent precomputing a summarised waveform to speed up display. The buffers are already quite large; I've tried increasing them by another factor 10 just to give it a try and the gain was negligible.
Re: Amadeus Pro slow file I/O
I see, that comes to about 20 cycles per sample.
Why does it take so long to write, then? Even if you read everything from disk and then write back to disk, at worst it should take twice as long, not 10x as long. Write speed is actually more noticeable to me, because I like to save frequently while I'm adding markers.
Why does it take so long to write, then? Even if you read everything from disk and then write back to disk, at worst it should take twice as long, not 10x as long. Write speed is actually more noticeable to me, because I like to save frequently while I'm adding markers.
- Martin Hairer
- Site Admin
- Posts: 1976
- Joined: Wed Nov 08, 2006 11:49 am
- Contact:
Re: Amadeus Pro slow file I/O
I've profiled the writing. There is a smallish (~10%) overhead coming from applying the volume envelope to the sound. This could in principle be sped up by detecting the case of a completely flat envelope at the start and treating it as a special case, but I would think that it's not worth the effort. The majority of the time (~50%) is spent in the system's primitive "fwrite" call. The only way I could plausibly improve the performance of that is by using larger buffers. Again, I've tried that by increasing the size of the buffers by a factor 10 and observed only very marginal performance gains (of the order of 5%). For the remaining time, about 10% is spent updating the GUI and the last 30% of the time is spent in a variety of function calls, mostly assembling the sound data from its in-memory representation to the write buffer.
Out of curiosity, I compared speeds to SoundStudio and Audacity using a 1.3GB 32-bit WAV file. Amadeus took 2.9s to read and 4.5s to write. Audacity took 10.5s to read and 3.8s to write, while SoundStudio took 1.7s to read and 7.8s to write. All this strongly suggests that further optimising the code could only lead to very minor gains.
Out of curiosity, I compared speeds to SoundStudio and Audacity using a 1.3GB 32-bit WAV file. Amadeus took 2.9s to read and 4.5s to write. Audacity took 10.5s to read and 3.8s to write, while SoundStudio took 1.7s to read and 7.8s to write. All this strongly suggests that further optimising the code could only lead to very minor gains.
Re: Amadeus Pro slow file I/O
Thanks for the research. I timed reading a 1GB file with Amadeus and with the trial version of Izotope RX and roughly the times are like what you have for Amadeus and SoundStudio.
If the file I/O takes about 50% of the time, the other processing could be done in parallel on a different thread for a 2x gain, if you're not already doing that.
If the file I/O takes about 50% of the time, the other processing could be done in parallel on a different thread for a 2x gain, if you're not already doing that.
- Martin Hairer
- Site Admin
- Posts: 1976
- Joined: Wed Nov 08, 2006 11:49 am
- Contact:
Re: Amadeus Pro slow file I/O
By spinning the writing itself off to a separate thread I can get the write time down to about 3.8 seconds, same as Audacity. I guess that's getting pretty close to optimal. (Speeding up by a factor two isn't realistic since there's still a data pipeline that needs to be synced...)
I'll probably include that into the next major update, please let me know if you're interested in beta-testing.
I'll probably include that into the next major update, please let me know if you're interested in beta-testing.