Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimisation consistency #1022

Open
elliotwoods opened this issue Mar 2, 2012 · 15 comments
Open

Optimisation consistency #1022

elliotwoods opened this issue Mar 2, 2012 · 15 comments

Comments

@elliotwoods
Copy link
Contributor

Continuation of http://forum.openframeworks.cc/index.php/topic,9095.msg42378.html#new

NOTE: Things may have changed as the projects I'm using are all created using the older creation tools.
Can somebody up to date please check?

Currently XCode's default project setting is /O2 for debug projects
whilst Visual Studio's is /O0

/O0 generally makes the most sense for debug mode as it allows for effective program flow and variable tracking (because with /O2, lines of code and variables are commonly optimised away).

If we are worried that this will leave default users in a default 'slower state' then perhaps we could make release the default? Then people could be aware that they are selecting debug when they want to actually do some debugging?
But this may have other issues (such as some libraries might not perform as many checks as otherwise?)

it might be worth making users more aware of the 2 options anyway, and then start using them consistently

@damian0815
Copy link
Contributor

this is a big topic.. i'd suggest making debug the default option, but with O2 optimisations. i rarely notice the O2 debug setting when doing most debugging, and if i really need it i can set it back to O0 by hand (i figure anyone who knows how to use a debugger knows how to do this anyway!)

@elliotwoods
Copy link
Contributor Author

@DamianNZ - that is the current default in osx
but not in VS
but in VS, you can't debug at all at /O2

we could also consider oF code debug at /O2 but users project at /O0

@damian0815
Copy link
Contributor

oF code debug at O2 and user's project at O0 sounds good to me, just as long as the users know that they can make it faster if they choose to.

i'd still steer clear of defaulting to O0 on Xcode. perhaps consistency isn't as big a problem as you're suggesting, since GCC's optimiser works differently to VC's anyway.

@kylemcdonald
Copy link
Contributor

i would also suggest avoiding O0 as a default. which one of these are you more likely to hear?

  • why is my code so slow?
  • why are my variables being optimized away?

it is strange that VS acts so different in O2.

@elliotwoods
Copy link
Contributor Author

yep.
it almost makes sense how it is now
most optimisation whilst preserving basic debugging capability
but it makes me think the default compile option on vs should maybe be Release
so that users don't indeed complain 'why is my code so slow', especially compared to osx

@ofTheo
Copy link
Member

ofTheo commented Mar 12, 2012

@elliotwoods agreed!
what about O1 for VS - does that allow debugging?

@elliotwoods
Copy link
Contributor Author

i'm not 100%, but am pretty sure that /O1 also blocks debugging
(otherwise i'd be using /O1)

@colormotor
Copy link

I would vote for using /O0 with Debug mode and perhaps use Release by default.
Debugging with optimization is quite frustrating.
Also it can give some satisfaction to see code running twice as fast when compiling in release mode :)

@ofTheo
Copy link
Member

ofTheo commented Mar 26, 2012

so the suggestion would be /O0 for debug but we would make Release the default so people don't complain about code slowdown?

@ofZach @arturoc how does that sound?

or we could have debug/ reallyDebug/ and Release/ ;)

@colormotor
Copy link

yes.
I also think that right now it might be hard for a novice user trying to debug, to figure out why the debugger is not functioning correctly, since debugging is pretty straight forward while compiler options may be a bit more misterious.
maybe make a debugOptimized mode?

@armadillu
Copy link
Contributor

I agree with colormotor. More than actively trying to debug him/herself, a novice will quite likely get crashes. With the optimizations enabled by default, it will be even even more difficult to find out where / why the program crashed.

@elliotwoods
Copy link
Contributor Author

update :
actually it is possible to debug in vs2010 with optimisations (including /O2)
you just have to turn off a bunch of other things (e.g. edit and continue)
suggesting DebugOptimized as default

sorry for missing this before

@memo
Copy link
Member

memo commented Nov 2, 2014

re-igniting this thread. in xcode the default for the debug openframeworks project is Os which makes it undebuggable - and it's a shared project obviously, so you can't change it per project. To have optimizations which prevent debugging in a debug build I find a bit crazy to be honest! If people don't want to debug and prefer performance, they should run in release mode! that's what's for!

@bilderbuchi
Copy link
Member

hm, wasn't this fixed recently in master? I remember someone (@arturoc? @ofTheo?) noticing this a couple of days back.

@danoli3
Copy link
Member

danoli3 commented Jun 18, 2015

Re-igniting this @memo was this an issue with OS X project or iOS. I've just made changes to fix the iOS side. I'll have a look at the OSX settings as well...

@dimitre dimitre added this to the 0.12.1 milestone Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants