Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance of empty function on Dart

Let say I have this code:

void test(){
 assert(() {
   print("This is Test");
 });
}

As per this question, dart will remove assert on production build

but how about test() function which being called?

will this function be removed on build?

or will this have any significant impact on performance if I call empty function multiple times?

like image 499
selharxets Avatar asked Sep 19 '25 07:09

selharxets


1 Answers

The compiler will optimize your code through inlining and removing calls to empty functions.

like image 67
Günter Zöchbauer Avatar answered Sep 20 '25 22:09

Günter Zöchbauer