Old 04-13-2012, 03:30 AM   #41
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,005
Default Object variable can't be 1 character

I can't seem to use an "object" variable of just 1 character:

Code:
function foo(b)
  instance(bar)
(
  bar = b;
);

xx.foo(123); // Works
x.foo(123); // Error!
__________________
Martinic Kee Bass - Scanner Vibrato - Elka Panther - Tale's JSFX Pack
Tale is offline   Reply With Quote
Old 04-13-2012, 06:39 AM   #42
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by Tale View Post
Very cool! I was just playing around with this a bit, but I got an error when declaring local variables using locals(). However, then I saw that cyco130 used local() instead of locals()... So, which is it, local() or locals()?
Ooops, in the initial build it was locals(), but in the newer build it's local() (to match the adjectivity of instance()).
Justin is offline   Reply With Quote
Old 04-13-2012, 06:42 AM   #43
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by Tale View Post
I can't seem to use an "object" variable of just 1 character:

Code:
function foo(b)
  instance(bar)
(
  bar = b;
);

xx.foo(123); // Works
x.foo(123); // Error!


Fixing. Some one character names do work, too, but it's overly picky (because of the hack I did to the parser, heh).
Justin is offline   Reply With Quote
Old 04-13-2012, 01:43 PM   #44
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by cyco130 View Post
I've played a little with the new template/object system. How about a this keyword so a function can call another function with the current prefix?
This is a good idea, but I think we'll make it just implied (no this keyword) -- i.e.
Code:
function a(value) instance(state) 
(
  state=value;
);

function b(v)
(
  a(v);
);

function c(v)
(
  test2.a(v);
);

test1.b(10); // sets test1.state to 10
c(10); // sets test2.state to 10
whatever.c(10); // sets test2.state to 10
b(10); // sets b.state to 10 -- a() inherits b's prefix, and b() is the same as b.b().
...coming in the next build. Also, the current build's functions may not always work right on 64 bit platforms (if the function record is at an address higher than 4GB, it may be ignored). This will be fixed in the next build.

Edit: actually, designing support for nested objects as well (so you can have some.obj.func() etc)..

Edit again: hmm, might be better to get rid of the local() and instance() declarations, and just use this.var and local.var, to avoid questions of scope...

Last edited by Justin; 04-13-2012 at 06:28 PM.
Justin is offline   Reply With Quote
Old 04-13-2012, 06:47 PM   #45
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

While Jesusonic is getting some love, can you perhaps look at some way to receive MIDI messages containing more than a status and two bytes, such as SysEx? (See for example this thread)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-13-2012, 09:49 PM   #46
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

If you have this., do you even really need local.?

If you're going that way, I'd kinda prefer static. instead of local., seeing as that's more like what it is.
dub3000 is offline   Reply With Quote
Old 04-14-2012, 03:24 AM   #47
cyco130
Human being with feelings
 
Join Date: Apr 2012
Posts: 4
Default

Quote:
Originally Posted by Justin View Post
Edit: actually, designing support for nested objects as well (so you can have some.obj.func() etc)..
Yay! That was on my upcoming request list I've already converted the whole RBJ cookbook biquad formulae to JS functions. Now if I want, say, 4th order filter functions I can implement them as nested biquads without copy/paste. Thank you sir!
Quote:
Originally Posted by Justin View Post
hmm, might be better to get rid of the local() and instance() declarations, and just use this.var and local.var, to avoid questions of scope...
I'd prefer the things as they are now. Look at this actual example:
Code:
    function bqMono(x0) // Apply a mono biquad filter designed beforehand
        instance(x1, x2, y1, y2, a1, a2, b0, b1, b2)
        local(y0)
    (
        y0 = b0 * x0 + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
        x2 = x1; x1 = x0;
        y2 = y1; y1 = y0; // This is also the return value
    );
Now rewriting it with "this." and "local." all over the place would be much less readable. And much less concise.

Quote:
Originally Posted by dub3000 View Post
If you have this., do you even really need local.?

If you're going that way, I'd kinda prefer static. instead of local., seeing as that's more like what it is.
But they are locals. They are static locals not auto locals in C parlance but they are locals

***

Again, I've already implemented a set of function libraries. I'm currently using C preprocessor to #include them. I only use #include, and multiple inclusion guards (#ifdef BUIQUAD_JSI etc.). Adding such a feature natively would open up the possibility of sharing this kind of libraries with the community. Think about reusable filters, LFOs, envelope followers, delay lines... But also reusable knobs, sliders, vu meters etc.

Last edited by cyco130; 04-14-2012 at 03:27 AM. Reason: Spelling
cyco130 is offline   Reply With Quote
Old 04-14-2012, 05:17 AM   #48
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by cyco130 View Post
[...] Think about reusable filters, LFOs, envelope followers, delay lines... But also reusable knobs, sliders, vu meters etc.
I'm thinking ReaCyle.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-14-2012, 02:52 PM   #49
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

OK, a new build is up as of April 14. Changes:
  • Fixed potential function issues on 64 bit
  • Local variables are now stored separately by section to avoid potential threading issues (i.e. if a function is declared in @init, and has local(x), x will be a different var when used from @init vs @sample vs @gfx etc).
  • You can access instance variables via the "this." prefix. So for example:
    Code:
    function f() 
    (
      this.test = 1;
    );
    whatever.f(); // sets whatever.test = 1
    This syntax also allows nesting:
    Code:
    function f() ( this.test = 1; );
    function g() 
    ( 
      this.obj1.f(); 
      this.obj2.f(); 
      this.obj1.test - this.obj2.test;
    );
    
    a = whatever.g(); // a is now 0
  • You can still use instance() to declare access to member variables, but internally it translates these variables into "this.<whatever>". If you use instance(a), you can also then access a, a(), a.variable, a.variable.sub, or a.function() as members. Example modification of the above code:
    Code:
    function f() instance(test) ( test = 1; );
    function g() instance(obj1 obj2)
    ( 
      obj1.f(); 
      obj2.f(); 
      obj1.test - obj2.test;
    );
    
    a = whatever.g(); // a is now 0
  • You can use "this..whatever" to access the parent's namespace (or this...whatever for two parents up).. For example:
    Code:
    function a() 
    ( 
      this..test=1; 
    ); 
    some.object.a(); // sets some.test=1
  • Probably fixed/broke other things, did a lot of internal cleanups... We'll release the new version of EEL2 on git once this settles down.

I'm still planning on adding a JS-specific @include syntax, so we can include common code, but I'm just getting these language features sorted before doing that (i.e. if we need to change syntax, I don't want to encourage TOO much code to be written this way).

Last edited by Justin; 04-14-2012 at 05:15 PM.
Justin is offline   Reply With Quote
Old 04-14-2012, 04:35 PM   #50
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

Very cool!

If there's both static and local in there I reckon just keep it to local, having both will probably confuse people... (sorry :-/ )
dub3000 is offline   Reply With Quote
Old 04-14-2012, 05:15 PM   #51
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by dub3000 View Post
Very cool!

If there's both static and local in there I reckon just keep it to local, having both will probably confuse people... (sorry :-/ )
Fair enough, I'll remove it from the post at least
Justin is offline   Reply With Quote
Old 04-15-2012, 12:52 AM   #52
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,005
Default Can't return instance variable

I can't seem to directly return an instance variable anymore, i.e.:

Code:
function osc()
  instance(x, y)
(
  y = sin(x);
  x += 1/srate;
  y; // Error
);
If I change it like this it works fine:

Code:
0 + y; // OK
Interestingly it breaks again if I do y + 0 instead of 0 + y.

It doesn't matter if I use the this keyword instead of instancing the variables. However, if I declare y a local instead of an instance variable, then all is well.

EDIT: I have found another example where an instance variable doesn't work, while a local or global variable does work:

Code:
function foo(x)
  instance(y, z)
(
  y = x;
  loop(y, // Error
    z += 2;
  );
);
This time 0 + y also doesn't work, but y|0 does.
__________________
Martinic Kee Bass - Scanner Vibrato - Elka Panther - Tale's JSFX Pack

Last edited by Tale; 04-15-2012 at 01:17 AM. Reason: Added 2nd example
Tale is offline   Reply With Quote
Old 04-15-2012, 04:38 AM   #53
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

ok, i've got floaty ported to the new code. it runs a TINY bit slower (0.6% vs 0.5%) than the old one, i'm guessing it's just cache misses or something now that i'm processing left and right separately instead of interleaving them.

the code is way cleaner now though, much nicer :-)
dub3000 is offline   Reply With Quote
Old 04-15-2012, 07:26 AM   #54
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by Tale View Post
I can't seem to directly return an instance variable anymore, i.e.:

Code:
function osc()
  instance(x, y)
(
  y = sin(x);
  x += 1/srate;
  y; // Error
);
If I change it like this it works fine:

Code:
0 + y; // OK
Interestingly it breaks again if I do y + 0 instead of 0 + y.

It doesn't matter if I use the this keyword instead of instancing the variables. However, if I declare y a local instead of an instance variable, then all is well.

EDIT: I have found another example where an instance variable doesn't work, while a local or global variable does work:

Code:
function foo(x)
  instance(y, z)
(
  y = x;
  loop(y, // Error
    z += 2;
  );
);
This time 0 + y also doesn't work, but y|0 does.
Thanks for spotting this, updated the build with a fix.

Last edited by Justin; 04-15-2012 at 07:46 AM.
Justin is offline   Reply With Quote
Old 04-15-2012, 07:26 AM   #55
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by dub3000 View Post
ok, i've got floaty ported to the new code. it runs a TINY bit slower (0.6% vs 0.5%) than the old one, i'm guessing it's just cache misses or something now that i'm processing left and right separately instead of interleaving them.

the code is way cleaner now though, much nicer :-)
Hopefully the new code + new JS runs faster than the old code + old JS?
Justin is offline   Reply With Quote
Old 04-15-2012, 07:47 AM   #56
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Just updated the build, with a fix for the bug Tale spotted, but also some internal list cleanups that should make things compile slightly faster when using a lot of psuedo-objects.
Justin is offline   Reply With Quote
Old 04-15-2012, 07:50 AM   #57
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

Quote:
Originally Posted by Justin View Post
Hopefully the new code + new JS runs faster than the old code + old JS?
hmm... the weird thing is, the newest code posted today is pretty much equivalent to the performance of the older code.

this is CPU usage with 8 instances of the JS fx, default settings:

before (DLL size = 155,648 bytes)
floaty: 3.9%
paranoia: 1.9%
avocado: 4.5%
moog24db: 1.6%

after (DLL size = 164,864 bytes)
floaty: 3.9%
floaty v2: 4.6%
paranoia: 1.9%
avocado: 4.5%
moog24db: 1.6%

this is on windows 7 x64, with 32-bit reaper.

(edit: maybe because i try and pull out constants etc in my code, turn division into multiply already etc?)
dub3000 is offline   Reply With Quote
Old 04-15-2012, 08:02 AM   #58
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

dub, are those numbers for the same (oldschool) JS code in 4.22 vs the latest jsfx.dll? The newer jsfx.dll should have faster memory accesses ([]), as well as a lot of code generation improvements (avoid ing a bunch of excess stack access), which is why I'd think the same code should be at least slightly faster in the new jsfx.

Edit: actually, on second thought, if you're testing against the release jsfx build, and your code calls a decent number of math functions, the release jsfx build might be faster (since it is compiled with ICC which may optimize some of those functions more than the builds I've posted here). I'll do some proper ICC builds shortly. Having said that, comparing the build here, Ozzifier with 3 voices uses 0.9% CPU, vs 1.3% in 4.151's jsfx. Which is a big difference, but it does a lot of memory accesses...

Last edited by Justin; 04-15-2012 at 08:08 AM.
Justin is offline   Reply With Quote
Old 04-15-2012, 08:21 AM   #59
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,452
Default

are we going to get "browse" function ?
Sexan is offline   Reply With Quote
Old 04-15-2012, 11:25 AM   #60
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,005
Default

Quote:
Originally Posted by Justin View Post
Just updated the build, with a fix for the bug Tale spotted, but also some internal list cleanups that should make things compile slightly faster when using a lot of psuedo-objects.
Yes, that bug is fixed now, thanks.

Just to keep you off of the streets , here is another one: If you substract two constants, they are added instead of substracted:

Code:
x = 7.5 - 1.5; // x == 9 instead of 6
__________________
Martinic Kee Bass - Scanner Vibrato - Elka Panther - Tale's JSFX Pack
Tale is offline   Reply With Quote
Old 04-15-2012, 12:04 PM   #61
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,387
Default

Quote:
Originally Posted by Tale View Post
substract two constants, they are added instead of substracted
Yup, 1 - 1 is 2!
IXix is online now   Reply With Quote
Old 04-15-2012, 12:27 PM   #62
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,387
Default

Just starting to get my head round using objects and functions in JS. What a game changer! I'm a bit stunned. I honestly never thought it would happen.
IXix is online now   Reply With Quote
Old 04-15-2012, 12:28 PM   #63
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by Tale View Post
Yes, that bug is fixed now, thanks.

Just to keep you off of the streets , here is another one: If you substract two constants, they are added instead of substracted:

Code:
x = 7.5 - 1.5; // x == 9 instead of 6
Ah wow that's embarrassing! I swear I tested that but I guess I failed! Copy and paste fail. Fixing.
Justin is offline   Reply With Quote
Old 04-15-2012, 12:30 PM   #64
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by IXix View Post
Just starting to get my head round using objects and functions in JS. What a game changer! I'm a bit stunned. I honestly never thought it would happen.
Well, the objects are just effectively namespaces, i.e. you can't copy objects pass them anywhere... but yeah, I didn't think I'd ever go implement them either.
Justin is offline   Reply With Quote
Old 04-15-2012, 01:56 PM   #65
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by IXix View Post
Just starting to get my head round using objects and functions in JS. What a game changer! I'm a bit stunned. I honestly never thought it would happen.
Perhaps it should be renamed OO-Jesusonic.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-15-2012, 02:39 PM   #66
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,387
Default

Quote:
Originally Posted by Justin View Post
Well, the objects are just effectively namespaces, i.e. you can't copy objects pass them anywhere...
Ah yeah, they're namespaces, that makes sense. Is it super difficult to make them object enough to pass around? It would be so nice.
IXix is online now   Reply With Quote
Old 04-15-2012, 03:13 PM   #67
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 554
Default

wow! i'm a bit late to the party. but WOW! great stuff Justin. big thanks. and... will these xcool features make it into ReaJS at some point? hopefully yours, /dan

ps- OS X ReaJS??? has a nice ring to it...
bang is offline   Reply With Quote
Old 04-15-2012, 03:34 PM   #68
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by IXix View Post
Ah yeah, they're namespaces, that makes sense. Is it super difficult to make them object enough to pass around? It would be so nice.
Wouldn't passing pointers around suffice?

(and +1 for OS X ReaJS)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-15-2012, 04:25 PM   #69
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 554
Default

Quote:
Originally Posted by Banned View Post
Wouldn't passing pointers around suffice?
something like this Banned?
Code:
// class obj
value= 0;
somestate= 1;
obj_len= 2;

mem= 0;
obj1= mem; mem+= obj_len;
obj2= mem; mem+= obj_len;

function someMethod(obj,x) 
  (
     obj[somestate] = obj[value]*x;
  ); 

  obj1[value] = 32;
  someMethod(obj1,4);

  obj2[value] = 16;
  someMethod(obj2,2);
  
  v = obj1[somestate] == 128 && obj2[somestate] == 32;
  // v should be true
pretty sure i will be using this pattern a lot. maybe some syntactic sugar would help. enjoy! /dan
bang is offline   Reply With Quote
Old 04-15-2012, 04:30 PM   #70
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by Banned View Post
Wouldn't passing pointers around suffice?

(and +1 for OS X ReaJS)
It would be slow and/or require a lot of internal work. The namespaces are very fast. Maybe someday..
Justin is offline   Reply With Quote
Old 04-15-2012, 04:35 PM   #71
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

I've just updated the builds, with that optimization fix (- being + for constants). I also did some other work (a couple of JS editor bugfixes, memory leak fixes, and optimizations etc). The optimizer now optimizes |0 into a plain round-toward-zero, rather than ORing with 0. The builds are now compiled with ICC (as they would be in a REAPER release), so that might affect performance (positively!) too.
Justin is offline   Reply With Quote
Old 04-15-2012, 04:37 PM   #72
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by bang View Post
something like this Banned?
Code:
// class obj
value= 0;
somestate= 1;
obj_len= 2;

mem= 0;
obj1= mem; mem+= obj_len;
obj2= mem; mem+= obj_len;

function someMethod(obj,x) 
  (
     obj[somestate] = obj[value]*x;
  ); 

  obj1[value] = 32;
  someMethod(obj1,4);

  obj2[value] = 16;
  someMethod(obj2,2);
  
  v = obj1[somestate] == 128 && obj2[somestate] == 32;
  // v should be true
pretty sure i will be using this pattern a lot. maybe some syntactic sugar would help. enjoy! /dan

For this example, using namespaces will be a lot clearer and faster (at the expense of not being dynamic). Tranlsation:


Code:
// class obj

function someMethod(x) 
  (
     this.somestate = this.value*x;
  ); 

  obj1.value = 32;
  obj1.someMethod(4);

  obj2.value = 16;
  obj2.someMethod(2);
  
  v = obj1.somestate == 128 && obj2.somestate == 32;
  // v should be true
Justin is offline   Reply With Quote
Old 04-15-2012, 05:06 PM   #73
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 554
Default

Quote:
Originally Posted by Justin View Post
For this example, using namespaces will be a lot clearer and faster (at the expense of not being dynamic).
yes. but the dynamic/pointer-ish behavior requested by IXix and Banned was my point, so to speak.
bang is offline   Reply With Quote
Old 04-15-2012, 05:16 PM   #74
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 554
Default

Quote:
Originally Posted by bang View Post
yes. but the dynamic/pointer-ish behavior requested by IXix and Banned was my point, so to speak.
...so i guess my question is whether there could be clearer syntax for the case of array memory based "objects" when the ability to pass them around outweighs the speed penalty?
bang is offline   Reply With Quote
Old 04-15-2012, 06:10 PM   #75
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by bang View Post
...so i guess my question is whether there could be clearer syntax for the case of array memory based "objects" when the ability to pass them around outweighs the speed penalty?
Or maybe we can come up with some hybrid of the two that can have it all. I'll think about this some more...

Having said that, I am curious about thoughts where the namespace system reaches its limits -- not in general, but for this application. It already allows for a huge amount of reusability, perhaps that will be enough...
Justin is offline   Reply With Quote
Old 04-15-2012, 06:25 PM   #76
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 554
Default

Quote:
Originally Posted by Justin View Post
Or maybe we can come up with some hybrid of the two that can have it all. I'll think about this some more...
tia for your consideration!
Quote:
Originally Posted by Justin View Post
Having said that, I am curious about thoughts where the namespace system reaches its limits -- not in general, but for this application. It already allows for a huge amount of reusability, perhaps that will be enough...
not exactly sure what "this application" means here. the namespace system as is does provide gobs of reusability. vcool! where it would break down for me is when dealing with large amounts of parameter data. for instance, in arp!0 i use techniques similar to my example above (minus the lovely functions!) to iterate through similar but distinct parameter arrays, and also to load blocks of variant parameters en mass. the ability to pass references to sizeable chunks of structured data in & out of functions would be wonderfully useful imo. is this what you were asking for Justin?

enjoy! /dan
bang is offline   Reply With Quote
Old 04-15-2012, 06:44 PM   #77
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

in my opinion, there are three ways this stuff is useful:

* moving common stuff out into libraries (still need @include)
* keeping the same code path for left and right (and/or surround) channels.
* literate programming (e.g. my floaty v2 tweaks now reads like pseudocode instead of a nest of crufty array hacks).

imho, what we've got already hits a lot of those targets (as far as the hacky nature of it allows :-) )

could the "copy" functionality be accomplished by exploiting the namespace stuff we have already? e.g.

x.foo = 1;
x.bar = 2;
y = x; // copies all x.(.*) to y.(.*)?

(although to be honest, that probably wouldn't be useful for any of the specific use cases i can think of in my own code).

while we're at it (...), would be great to have a @hidden pragma or something so we can chuck libraries in there but not have them automatically show up in the browser. this would be useful for deprecating old effects as well, btw (there's a ton of ancient cruft in the JS fx folder).
dub3000 is offline   Reply With Quote
Old 04-15-2012, 07:28 PM   #78
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,578
Default

Quote:
Originally Posted by dub3000 View Post
i
while we're at it (...), would be great to have a @hidden pragma or something so we can chuck libraries in there but not have them automatically show up in the browser. this would be useful for deprecating old effects as well, btw (there's a ton of ancient cruft in the JS fx folder).

Thinking we'll either do a separate include folder (i.e. jsInclude/) or a different extension. I'm leaning towards the former. @hidden wouldn't work well, because at the moment REAPER just scans for files and doesn't open them when enumerating FX.
Justin is offline   Reply With Quote
Old 04-16-2012, 03:08 AM   #79
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

Quote:
Originally Posted by Justin View Post
dub, are those numbers for the same (oldschool) JS code in 4.22 vs the latest jsfx.dll? The newer jsfx.dll should have faster memory accesses ([]), as well as a lot of code generation improvements (avoid ing a bunch of excess stack access), which is why I'd think the same code should be at least slightly faster in the new jsfx.

Edit: actually, on second thought, if you're testing against the release jsfx build, and your code calls a decent number of math functions, the release jsfx build might be faster (since it is compiled with ICC which may optimize some of those functions more than the builds I've posted here). I'll do some proper ICC builds shortly. Having said that, comparing the build here, Ozzifier with 3 voices uses 0.9% CPU, vs 1.3% in 4.151's jsfx. Which is a big difference, but it does a lot of memory accesses...
tried again with the brand-new latest DLL, results appear to be pretty much the same as the previous one (32-bit).

This is an i5 750 @ 2.67GHz, Win7.
dub3000 is offline   Reply With Quote
Old 04-16-2012, 03:16 AM   #80
dub3000
Human being with feelings
 
dub3000's Avatar
 
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,834
Default

on 64 bit, with default everything (portable install)

before
floaty: 4.8%

after
floaty: 3.6%
floaty v2: 4.1%

so... the optimizations seem to make a much larger difference on x64? (and are now slightly faster than on x32, but weren't before?)
dub3000 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 02:36 AM.


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