File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
crates/kernel_cmdline/src Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,13 @@ impl<'a> IntoIterator for &'a Cmdline<'a> {
268268
269269impl < ' a , ' other > Extend < Parameter < ' other > > for Cmdline < ' a > {
270270 fn extend < T : IntoIterator < Item = Parameter < ' other > > > ( & mut self , iter : T ) {
271+ // Note this is O(N*M), but in practice this doesn't matter
272+ // because kernel cmdlines are typically quite small (limited
273+ // to at most 4k depending on arch). Using a hash-based
274+ // structure to reduce this to O(N)+C would likely raise the C
275+ // portion so much as to erase any benefit from removing the
276+ // combinatorial complexity. Plus CPUs are good at
277+ // caching/pipelining through contiguous memory.
271278 for param in iter {
272279 self . add ( & param) ;
273280 }
Original file line number Diff line number Diff line change @@ -192,6 +192,13 @@ impl<'a> IntoIterator for &'a Cmdline<'a> {
192192}
193193
194194impl < ' a , ' other > Extend < Parameter < ' other > > for Cmdline < ' a > {
195+ // Note this is O(N*M), but in practice this doesn't matter
196+ // because kernel cmdlines are typically quite small (limited
197+ // to at most 4k depending on arch). Using a hash-based
198+ // structure to reduce this to O(N)+C would likely raise the C
199+ // portion so much as to erase any benefit from removing the
200+ // combinatorial complexity. Plus CPUs are good at
201+ // caching/pipelining through contiguous memory.
195202 fn extend < T : IntoIterator < Item = Parameter < ' other > > > ( & mut self , iter : T ) {
196203 for param in iter {
197204 self . add ( & param) ;
You can’t perform that action at this time.
0 commit comments