in reply to coding style suggestion: (...)[1] vs. [...]->[1]
From looks, I like the anonymous array one too because brackets are...well, sexy. But for those interested in micro optimization, the benchmarks say that the list is faster.
Benchmark: running anon, list for at least 5 CPU seconds... anon: 6 wallclock secs ( 5.25 usr + 0.01 sys = 5.26 CPU) @ 875 +11.49/s (n=460119) list: 4 wallclock secs ( 5.29 usr + 0.00 sys = 5.29 CPU) @ 121 +428.51/s (n=642243) Rate anon list anon 87511/s -- -28% list 121429/s 39% --
Those are the benchmarks from your script above. Regardless how you vary the length of the string, the ratio held around the same. Hope this helps.
Anonymously yours
Anonymous Nun
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: coding style suggestion
by thens (Scribe) on Sep 19, 2003 at 13:40 UTC |