Using multiple namespaces weighs more?

5

Let's say I have these namespaces :

use
    DataTables\Editor,
    DataTables\Editor\Field;
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;

But I only really use 2 of them:

use
    DataTables\Editor,
    DataTables\Editor\Field;
    //DataTables\Editor\Format,
    //DataTables\Editor\Mjoin,
    //DataTables\Editor\Options,
    //DataTables\Editor\Upload,
    //DataTables\Editor\Validate;

As seen above, I do not need them. So, is there a considerable loss for leaving the other 5 namespaces even though I do not use it?

    
asked by anonymous 17.08.2017 / 17:11

1 answer

6

In the execution of the code itself does not weigh because it is only a facility to write the code without having to type the whole name.

It weighs slightly more to interpret the code since it has to do a complete analysis of what is there and that will not be used for anything. So I would take away not only performance that is a derisory gain, but to decrease the size of the code and make it a little easier to read and understand, because having something there can get the idea that the namespace is being used.

And it's not just the analysis of the text of use , when choosing what to use it will have to scan the names tables of all the namespaces , so it weighs a little, it's not just the text to parse .

And still have a chance to end up creating a conflict for nothing to make available classes that will not even be used but can have a name equal to some other namespace with potential use.

    
17.08.2017 / 17:16