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

Boatloads of non-inlined functions #1

Closed
jamshark70 opened this issue Dec 27, 2013 · 2 comments
Closed

Boatloads of non-inlined functions #1

jamshark70 opened this issue Dec 27, 2013 · 2 comments

Comments

@jamshark70
Copy link

This isn't a functionality problem, but it's untidy and will also slow the code down.

WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/EventStream.sc'
  line 170 char 28:

            var key = [ this, name ];

            this.do(f);
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/EventStream.sc'
  line 172 char 29:

            dict.at( key ) !? { |oldf| this.stopDoing( oldf ) };

            dict.put( key, f)
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/EventStream.sc'
  line 175 char 28:

            var key = [ this, name ];

            dict.at( key ) !? { |oldf| this.stopDoing( oldf ) };
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/EventStream.sc'
  line 176 char 29:

            dict.at( key ) !? { |oldf| this.stopDoing( oldf ) };

            dict.put( key , nil)
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/EventStream.sc'
  line 252 char 55:

            var bus = Bus.control(server, initVal.asArray.size);

            var f = { |x| bus.setn( x.asArray ) };
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 151 char 62:

                  var restOfSemicolons = semicolons[1..].asLazy;

                  var default = Tuple2(None(), restOfSemicolons).success;
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 211 char 96:

                      var rest = this.processDoBlock(string[(posLastSemicolonToBeProcessed+1)..]);

                      rest.collect{ |rest|
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 262 char 45:

                      var nextnpar = numpar -1;

                      //"removing p".postln;
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 284 char 23:

              }.sequence;

              var ends = if(preends.isKindOf(Array)){ preends.success } {preends};
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 327 char 22:

                      };

                      var start = orderedDoBloks[0][0];
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 370 char 53:

              var end = string[(start+2)..].find("\n");

              if(end.isNil) {
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Monads/DoNotation.sc'
  line 385 char 53:

              var end = string[(start+2)..].find("*/");

              if(end.isNil) {
-----------------------------------
ERROR: Class extension for nonexistent class 'MKtlElement'
     In file:'/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/EventStream/NetworkDescriptionAdditions.sc'
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Additions/TypeClasses-Object.sc'
  line 143 char 38:

                  var end = this.size-2;

                  this[0..end].injectr(this.last.collect{ |x| [x] }, { |mstate,m|
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Additions/TypeClasses-Object.sc'
  line 160 char 38:

                  var end = this.size-2;

                  this[0..end].injectr(this.last.collect{ Unit }, { |mstate,m|
-----------------------------------
WARNING: FunctionDef contains variable declarations and so will not be inlined.
  in file '/home/dlm/.local/share/SuperCollider/Extensions/FPLib/Classes/Additions/TypeClasses-Object.sc'
  line 177 char 38:

                  var end = this.size-2;

                  this[0..end].injectr( f.( this.last ).collect{ |z| [z] }, { |ys,v|
-----------------------------------
@miguel-negrao
Copy link
Owner

I guess most of those warning can be removed, although it will make the code even harder to understand. Functional programming uses a lot of... functions. :-)

@miguel-negrao
Copy link
Owner

Had a look, a lot of those warnings are for arguments of anonymous functions, so those certainly can't be removed. Looking at the remaining ones, declaring the variable earlier in the code introduces the possibility of more bugs since you can then mutate the variable outside the anonymous function in between the declaration and the next subsequent use. I looked at the cases where this happened and only in two places were they performance sensitive. I've changed those, and left the remaining unaltered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants