[LEDE-DEV] [PATCH 1/5] base-files: introduce /lib/functions/board.sh
Roman Yeryomin
leroi.lists at gmail.com
Tue May 2 11:31:18 PDT 2017
On 2 May 2017 at 20:46, Felix Fietkau <nbd at nbd.name> wrote:
> On 2017-05-02 19:32, Roman Yeryomin wrote:
>> I just want to save maintenance time. As you admit it's already a
>> clutter. I'm trying to introduce some order.
>> Actually uci-defaults is another one which doesn't need 90% of
>> functions.sh (it only needs list_contains).
>> I would propose breaking down functions.sh into smaller files by
>> functionality, e.g. config/user/base/etc., together with optimizing
>> it's usage in other scripts.
>> Then /lib/functions.sh could become a meta include which includes
>> everything under /lib/functions/. It would be more logical and
>> structurally more right than including functions.sh from a script from
>> /lib/functions/.
> I think effectively you're making the whole thing slower and bigger at
> the same time. Processing the extra includes certainly results in extra
> syscalls and extra overhead, maybe even extra memory overhead.
> Additionally I'd say it does nothing to make the maintenance any easier.
> Please don't go that route, it really doesn't help.
>
Why do you think so?
I've done tests, including few smaller files with only needed
functions actually is better than including one big file like
functions.sh.
Performance hit for bigger includes is more than from several small
ones. It's 10-20ms vs. 700-800ms over 100 iterations on ipq8065.
And why do you say it will not make maintenance easier? Right now one
cannot understand what is what. If you name things it would become
more clear and easier to understand. Simply including a big
functions.sh doesn't say anything and IMO can only be a workaround,
when you don't know what you need. But even now this doesn't work
because there are separate files in /lib/functions/
Regards,
Roman
More information about the Lede-dev
mailing list