COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 07-22-2020, 06:04 PM   #1
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default Massive CPU load difference between Mac and Win versions of plugins - SOLVED

I am seeing a HUGE difference in CPU load running my Mac plugin builds verses Windows builds.

For example, my worst plugin shows 30% CPU load in Pro Tools on Mac (unacceptable) - but only 9% for the same project setup in Pro Tools on Win 10. Same Pro Tools versions, same track count/setup.

Likewise, in Reaper the VST, VST3 and AU versions of the plugin run around 5% CPU on Mac - but only 3% on Win 10!

A 10x difference from worst to best! Same code, same compiler "Release Build" settings.

My Xcode and MSVS compilers are both set for -03 release optimization (Fastest code) so what could be causing such a huge difference in CPU load across platforms and DAWs?

(My test iMac (OS Mojave) and Win 10 PCs are comparable hardware - both Quad core with 8GB RAM. Testing for all plugin types, OS and DAWs were done with one stereo track and one stereo plugin instance.)


SOLVED - problem was in Xcode compiler settings - scheme used for "Release" was being built using debug settings

Last edited by Nonlinear; 07-26-2020 at 10:23 PM.
Nonlinear is offline   Reply With Quote
Old 07-22-2020, 11:55 PM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Maybe it's data misalignment? Doubles or structs/classes holding doubles require WDL_FIXALIGN, or else they won't necessarily be aligned to 8 bytes in Xcode.
Tale is offline   Reply With Quote
Old 07-23-2020, 09:34 AM   #3
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by Tale View Post
Maybe it's data misalignment? Doubles or structs/classes holding doubles require WDL_FIXALIGN, or else they won't necessarily be aligned to 8 bytes in Xcode.
IDK but willing to check it out. How do I implement "WDL_FIXALIGN" and can it be applied GLOBALLY? All of the iPlug support files use doubles AFAIK - so they're everywhere.

I tried placing
Code:
#define double double WDL_FIXALIGN
at the top of my main .cpp file but it had no effect.

Last edited by Nonlinear; 07-23-2020 at 09:48 AM.
Nonlinear is offline   Reply With Quote
Old 07-23-2020, 10:16 AM   #4
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

You need to add WDL_FIXALIGN to any doubles inside a struct/class that might be misaligned, e.g.:

Code:
struct Foo
{
	int x;
	double WDL_FIXALIGN y;
};

struct Bar
{
	double a;
	int b;
}
WDL_FIXALIGN;
AFAIK local variables are always properly aligned, because they are on the stack, so you only need to worry about global variables and structs/classes.

You could first try to narrow down what part of your code slows things down by temporarily disabling chunks of code. That way you could probably only add WDL_FIXALIGN where it's really needed.

BTW, are you sure you are really using the same compiler flags? Because if e.g. you're using /fp:fast on MSVC, but no -ffast-math in Xcode, then this might also slow things down...
Tale is offline   Reply With Quote
Old 07-23-2020, 12:55 PM   #5
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by Tale View Post
You need to add WDL_FIXALIGN to any doubles inside a struct/class that might be misaligned, e.g.:

Code:
struct Foo
{
	int x;
	double WDL_FIXALIGN y;
};

struct Bar
{
	double a;
	int b;
}
WDL_FIXALIGN;
AFAIK local variables are always properly aligned, because they are on the stack, so you only need to worry about global variables and structs/classes.

You could first try to narrow down what part of your code slows things down by temporarily disabling chunks of code. That way you could probably only add WDL_FIXALIGN where it's really needed.

BTW, are you sure you are really using the same compiler flags? Because if e.g. you're using /fp:fast on MSVC, but no -ffast-math in Xcode, then this might also slow things down...
Thank you for the reply. Now, two things:

1) truth be told, all of my internal variables are floats not doubles. Contrary to what everyone says I found floats to process much faster than doubles HOWEVER that may be the issue in AAX. Will have to check it out.

2) I thought "-ffast-math" was on by default but I don’t see it anywhere in my Xcode settings - will check this out.

Last edited by Nonlinear; 07-23-2020 at 08:15 PM.
Nonlinear is offline   Reply With Quote
Old 07-24-2020, 12:31 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Xcode calls it "Relax IEEE Compliance", and it should be enabled (IMHO, YMMV).
Tale is offline   Reply With Quote
Old 07-24-2020, 08:48 AM   #7
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by Tale View Post
Xcode calls it "Relax IEEE Compliance", and it should be enabled (IMHO, YMMV).
For whatever reason it was NOT enabled - for any of my builds/plugin versions - but compiling with/without made no difference in my case nevertheless. No change in CPU load per DAW meters. Still WAY too high in Pro Tools.


One other Xcode question if I may - when I recompile my plugins over existing builds the new AAX/VST/VST3/AU files are saving to the respective library/audio plugins folders but their date and time is not updating. It appears like it didn't build - but when I check the files they ARE new versions. If I delete the plugin files first THEN build, all the files show correct date/time.

Any idea why the Mojave file manager - or maybe Xcode - is updating the file contents but not updating their date & time?

Last edited by Nonlinear; 07-24-2020 at 01:00 PM.
Nonlinear is offline   Reply With Quote
Old 07-25-2020, 01:31 AM   #8
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

I dunno... But probably it's just updating YourPlug.vst/Contents/MacOS/YourPlug.
Tale is offline   Reply With Quote
Old 07-25-2020, 08:29 AM   #9
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by Tale View Post
...probably it's just updating YourPlug.vst/Contents/MacOS/YourPlug.
Ah, yes! Had to drill down to see that.

Thank you.
Nonlinear is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.