Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Ruby/Forth challenge for WJ Date: Tue, 12 Jan 2016 18:39:30 -0800 Organization: A noiseless patient Spider Lines: 13 Message-ID: <87a8oaurrx.fsf@nightsong.com> References: <35f4686c-f2c4-4ed8-9c46-2238645b9b97@googlegroups.com> <6e01edb6-e936-4418-bb77-e2ef9369a339@googlegroups.com> <87si22mj3x.fsf@jester.gateway.pace.com> <87oacqmilx.fsf@jester.gateway.pace.com> <2a5759c0-2109-4bd5-bc31-8a87aaebecc0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="89fc4f87faf042e7e4d428a3639a51e3"; logging-data="11433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+06Gs04EnaENaHqZiQwh01" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:gmt6BsHdITg0AovLphR8+6uejPk= sha1:FfU6LriaOv7cBnapKxcl49ccTHE= Xref: csiph.com comp.lang.forth:44811 mhx@iae.nl writes: >> for (uint8_t b: buf) { >> ++counts[b]; >> } ... > > The compiler should have noticed that you aren't doing anything > with the contents of buf. In C++11, the "for (uint_t b: buf) ..." syntax means that b iterates through the contents of buf. OTOH it's true that I didn't do anything with the contents of counts. But I had tested with smaller bufs earlier and the runtime scaled linearly.