Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
28th October 2015, 04:24 | #1 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Why Is BitBlt Expensive on Memory?
I've been trying to optimize performance of the AviSynth Shader plugin. Here's something I just found out: the conversion to float itself is very expensive on memory. What's surprising is: what's taking up most of the memory is BitBlt!
If I run in a single thread Memory usage without any calls is 11MB With ConvertToYV24, it goes up to 28MB Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 30MB Uncommenting BitBlt within ConvertToFloat doesn't change memory usage. Now let's do it with 8 threads Memory usage without any calls is 42MB With ConvertToYV24, it goes up to 102MB Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 121MB Uncommenting BitBlt within ConvertToFloat... it goes up to 275MB!! env->BitBlt(dst, pitch2, halfFloatBuffer, halfFloatBufferPitch, halfFloatBufferPitch, height); ConvertToFloat().ConvertFromFloat() then take up 566MB on their own. ConvertToFloat().ConvertFromFloat().ConvertToFloat().ConvertFromFloat() take up 604MB. What's going on here?
__________________
FrameRateConverter | AvisynthShader | AvsFilterNet | Natural Grounding Player with Yin Media Encoder, 432hz Player, Powerliminals Player and Audio Video Muxer Last edited by MysteryX; 28th October 2015 at 04:27. |
28th October 2015, 11:42 | #2 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
When it comes to the full SuperRes script with 2 passes, and running it twice within a larger script with 4 threads, performance looks like this.
FPS (min | max | average): 0.533 | 1000000 | 7.035 Memory usage (phys | virt): 1173 | 1702 MB Thread count: 195 CPU usage (average): 42% If I comment BitBlt in the frame format conversion, then performance is this FPS (cur | min | max | avg): 4.571 | 0.542 | 1000000 | 8.797 Memory usage (phys | virt): 779 | 1682 MB Thread count: 190 CPU usage (current | average): 45% | 37% Virtual memory is similar, but there is a drastic difference in physical memory usage. When it comes to the 2GB limit, which one matters? |
28th October 2015, 13:18 | #3 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
OK, I've done plenty of tests around this. What varies is physical memory, not virtual memory. It probably sees no need to use physical memory when the data isn't being used, period. So it's fine.
I did manage to do considerable memory optimizations somewhere else. |
|
|