Re: [Vala] idea for vala performance optimization



From: Michele Dionisio <michele dionisio gmail com>

Sent: Saturday, 21 November 2015, 9:37
Subject: [Vala] idea for vala performance optimization

Ok, this is the only way because the C standard does not support closures
by itself. But gcc support closure in not standard "nested functions".

https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html

so it is teorically possible to avoid to make a lot of copy.




From the document you reference:

"If you try to call the nested function through its address after the containing function has exited, all 
hell will break loose. If you try to call it after a containing scope level has exited, and if it refers to 
some of the variables that are no longer in scope, you may be lucky, but it's not wise to take the risk. If, 
however, the nested function does not refer to anything that has gone out of scope, you should be safe."

GCC nested functions are not closures.

do you think that it can be convenient to try to develop a special "vala to
c converter" for gcc to test the real speed benefit?


Unfortunately not a good idea. GCC nested functions are not closures. Even if they were it would
tie Vala to a specific C compiler which I find a valid objection. Finally a pointer to the
context data is passed in a closure, not the data itself. Why are you so sure the C compiler
handles this in an inefficient manner?


Al


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]