Old 04-09-2014, 03:57 AM   #1
lossius
Human being with feelings
 
Join Date: Jul 2011
Location: Bergen, Norway
Posts: 123
Default JS: Using functions in @sample

I'm developing a set of plugins with quite a bit of shared code. In order to make the code more DRY (Don't Repeat Yourself) I have implemented a lot of this stuff as functions located in a separate lib file, and that works well.

I now need to implement some DSP processing in the @sample part of the code that also is to be used by several plugins. It is tempting to do this as a function in the lib file as well, and then call the function from within the @sample block. However I am concerned about whether this might cause additional processing overhead as compared to having the code directly in the @sample block itself.

If this was a C++ project I would use inline and get the best of both worlds, but are there any advices regarding this in JS?

Thanks!
Trond
lossius is offline   Reply With Quote
Old 04-09-2014, 04:31 AM   #2
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,681
Default

I think I read somewhere that functions are compiled "in-line" when Ctrl+s is pressed.

I'll try a Search.
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 04-09-2014, 08:20 AM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,746
Default

There can be a small amount of overhead, but it really depends. Try it and test
Justin 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 07:41 PM.


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