 |
|
|
02-15-2023, 03:15 PM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
Performance optimization for JSFX
I have developed a JSFX that loads many large image files to display the user interface. Unfortunately, I can't load many JSFX instances into a Reaper project because it quickly fills up my memory. I suspect this is due to the many large image files that each JSFX instance loads. Is there any way to be able to load many JSFX instances into a Reaper project without quickly filling up my RAM?
Last edited by mawi; 05-30-2023 at 11:20 AM.
|
|
|
05-30-2023, 11:21 AM
|
#2
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
I did a little comparison with JSFX and VST2. Once 100 tracks with one JSFX instance each and then once 100 tracks with one VST2 instance each. Compared to VST2 and VST3, JSFX uses almost twice as much CPU and three times as much RAM. Is there any way to minimize/optimize the CPU and memory consumption of JSFX?
Last edited by mawi; 05-30-2023 at 11:28 AM.
|
|
|
05-30-2023, 11:55 AM
|
#3
|
Human being with feelings
Join Date: Sep 2018
Location: HH
Posts: 886
|
I'd say it depends on the type of plugin and what it does.
ext_tail_size would be one option you could use.
Another option would be to execute only the parts of the code that are actually needed.
It's hard to say without seeing your code.
|
|
|
05-30-2023, 01:16 PM
|
#5
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
The folder with the image files for my JSFX is about 18MB on the hard disk. When I load my JSFX with the images it consumes about 180MB of RAM per instance.
Last edited by mawi; 05-30-2023 at 03:35 PM.
|
|
|
05-30-2023, 07:49 PM
|
#6
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
Are you resizing the images?
It could be that the images are constantly being resized, this is obviously bad. Put a check in there such that the image is only resized when the window size changes.
|
|
|
05-31-2023, 03:57 AM
|
#7
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
Yes, I change the image size depending on the window size. But the image size is changed only when the window size is changed. I don't know of any other way to do this. This would also not explain the large RAM consumption for all JSFX loading images. Is this not the case for you?
|
|
|
05-31-2023, 07:33 AM
|
#8
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,628
|
What kind of image files are we talkking about? Because PNG images will usually be stored in compressed format, but when they are loaded into memory they are decompressed, probably talking up width*height*4 bytes of memory.
Also note that a VST might share images across multiple instances, so it doesn't matter if you load 1 or 10 instances; it will load only 1 set of images. AFAIK JSFX won't do this when you load images using gfx_loadimg(), so then you would end up with 10 sets of images, not just 1 set.
|
|
|
05-31-2023, 08:46 AM
|
#9
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
That's exactly what I noticed as well. I also thought at first it was because of the png files being decompressed. But i couldn't see much difference in RAM use between png, jpg and bmp. I tried to load images via import and gfx_loadimg, but I couldn't see any difference either. Via import I can only load png images. Is this maybe a bug? Is there a way with JSFX to share 1 set of images between multiple instances, like with VST?
|
|
|
05-31-2023, 09:21 AM
|
#10
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,586
|
Hmm it may be that we can add jsfx image sharing/deduplication (with copy-on-write), let me look at this.
Last edited by Justin; 05-31-2023 at 09:28 AM.
|
|
|
05-31-2023, 09:59 AM
|
#11
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
That would be nice!
|
|
|
06-03-2023, 07:53 AM
|
#12
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,586
|
…coming in the next dev builds
|
|
|
06-03-2023, 11:05 AM
|
#13
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,167
|
Great, I will test it right away.
|
|
|
08-11-2023, 07:00 PM
|
#14
|
Human being with feelings
Join Date: Jan 2022
Location: Misiones, Argentina
Posts: 17
|
I have also noticed double cpu usage. I've found Verbity's emulation of Air Windows in jsfx, and sure enough: On my Dell Latitude 2120, an instance of Verbity in vst consumes 2%, while the jsfx consumes 5.
There is also a version of thebess plug-in, which vst consumes 5% and js 20.
As a visually impaired person, I prefer to work with js, since the sliders are more transparent, and there are the combo boxes, which also help to label the different options. Another benefit is the task of editing an automation point. In vst the values are floats between 0 and 1, while in js they are exact, like -6 or -12 dB, 50 or 100 ms etc. If jsfx performance improves I can use much more fluently.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:38 AM.
|