1 |
В Срд, 15/10/2008 в 20:51 +0100, Steve Long пишет: |
2 |
> >> for ((i=0;i<100000;i++)); do echo /usr/share/doc/${P}/examples > |
3 |
> >> /dev/null; |
4 |
> > |
5 |
> >> real 11.25 |
6 |
> > |
7 |
> >> real 9.24 |
8 |
> > |
9 |
> > So that's what, on the order of 20 microseconds faster for each iteration? |
10 |
> > |
11 |
> Or ~18%. (You shouldn't use the first iteration in general, btw.) |
12 |
|
13 |
Steve, your example only tests how much time bash takes to parse string. |
14 |
It's obvious that in quoted strings some expansions could be avoided and |
15 |
thus bash works faster. But although ebuilds use bash syntax they are |
16 |
interpreted not only by bash - the time to parse stings is negligible to |
17 |
other activities. I have not calculated but made a rough estimation |
18 |
taking into account the number of ebuilds in the tree. So I think we |
19 |
have of order of 10^6 string. This means that during merge of all |
20 |
packages we'll win 10 seconds. I don't think it's worth to consider this |
21 |
gain. |
22 |
|
23 |
So in portage tree this is the matter of style. That's said, since |
24 |
personally I don't have any preference on this style and until there |
25 |
will be arguments not to use this style I'll start to use full quotation |
26 |
of the strings. |
27 |
|
28 |
And yes, in pure bash programs possibly this'll make sense. |
29 |
|
30 |
-- |
31 |
Peter. |