smack-team/smack — pull request #51 by rafal-krypa (2014-02-18 12:30:51+00:00)
Title: Rule loading speed optimizations

When a project has large Smack policy and cares about time needed to boot the system, the Smack policy loading time becomes interesting. It's the only functionality of this project that could use speed optimizations.
In Tizen 2.x, with policy of 20K rules and 600 different labels, on the ARM development targets, smackload needs 570 ms to load the whole policy. It's also important, that the policy is read from dozens of files.
Current implementation of policy loading isn't very efficient. Every file is read line by line, each line is parsed and stored on the list (parsing has benefit of format error detection). Then each rule is converted back to textual form and sent to kernel, via either `load2` or `change-rule` interface, one by one.
This can be improved by:
- Using multiple rules per write, as enabled by Smack since kernel 3.12
- Improving implementation in user space
- Further optimizations of kernel interface, if needed (probably not)