nested and on-the-fly functions removed, bind introduced instead#43
nested and on-the-fly functions removed, bind introduced instead#43veljkopopovic wants to merge 1 commit intojhiesey:masterfrom
Conversation
…owing less memory leak ...
|
How much does this improve memory usage in practice? I'd like to see some numbers before merging, especially since I don't personally like this stylistically as much. |
|
Merge it or not, it's up to you. If you do some comparison, feel free to Main reasons I have done it this way was to, first of all, remove so called Best regards On Sun, Jul 10, 2016 at 8:54 AM John Hiesey notifications@github.com
|
|
Sounds like it might help. I'll give it a test in a few modern browsers sometime in the near future and let you know how it goes. Thanks! |
|
I think this would also help with a Google Closure Compiler error I'm running into: (The filename/line number are cryptic, but I've traced them back to https://github.com/jhiesey/stream-http/blob/v2.7.2/lib/response.js#L46) So, I'd like to put in a vote for getting this merged (after conflicts are fixed) :-) |
|
OK, I'll take another look into this week and see about fixing the conflicts. |
Using bind instead of 'on-the-fly' functions, self variable will not be trapped in a closure, allowing garbage collector to release resources once function is done.
On the other hand, 'on-the-fly' functions introduces a bit of performance penalty since engine is forced to compile function over and over again.
This way, functions are statically created, no context variable dependency, arguments remain only function input parameter ...