From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Advent of Code Day 6 Date: Mon, 7 Dec 2020 14:32:19 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <3daf539f-d0d9-431d-92ff-8210fd520793n@googlegroups.com> <5b8e43c3-ed39-4a44-8aa6-bc00d43be624n@googlegroups.com> <10a26bc3-9f76-4857-be6d-ec00fccbdbc9n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 7 Dec 2020 13:32:19 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="f526e9b59507a4011fcd741b72cbe48f"; logging-data="18325"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eFYcxTizfjnnO8zHLgTPRDO9JtQbT9Rg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 Cancel-Lock: sha1:bBwk8FqUr2trcomuZWbFqvM4rL8= In-Reply-To: <10a26bc3-9f76-4857-be6d-ec00fccbdbc9n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:60756 List-Id: On 12/7/20 11:55 AM, Maxim Reznik wrote: > In my solution I use a custom type - a boolean flag for each character. It takes 26 bytes (or even bits if you add `with Pack` aspect) and should be quite fast. Having this type it's easy to do `and` and `or` between such maps: Fast? I have made no attempt to make my solutions fast, and the slowest one gives real 0m0.059s user 0m0.007s sys 0m0.000s using the Linux "time" command. All of them have a user time < 10 ms. Almost all the real time is doing I/O. And there are no timing requirements. "Fast" should not be something anyone is worrying about. -- Jeff Carter "Ah, go away or I'll kill ya." Never Give a Sucker an Even Break 100