I have gone back and improved the code a bit for day 22 part 2 - well,  quite a lot.

Part 2 is now solved in ~1 second in ~ 6.5 MB ! (It was 30-60x slower and perhaps
1500x more space-consuming.)

Will comment more when Raul presents his comments next week.

Mike


On 06/01/2022 09:19, 'Mike Day' via Programming wrote:
ca 1/3 & 1/8 on time & space - quite an improvement!  Well done!

Mike

Sent from my iPad

On 6 Jan 2022, at 05:42, Raul Miller <rauldmil...@gmail.com> wrote:

Mine isn't a whole lot better than that, but I guess it's a little better.

   timespacex 'b22 input'
24.2392 1.15927e9

FYI,

--
Raul

On Wed, Jan 5, 2022 at 7:08 PM 'Michael Day' via Programming
<programm...@jsoftware.com> wrote:
I don't think there are any spoilers here.

Well,  I have at last managed to do part 2 of day 22,  one of those
"days" when part 2 is considerably harder
than part 1.  (I've found day 22 the hardest so far:  day 21 part2's
Dirac Die was tricky,  because I'd forgotten every go
had 3 throws,  but not really hard;  day 19 was quite hard,  needing
working out how to reconcile "scanners";
I spent ages on day 18's snailfish having gone down a cul-de-sac with a
nested array approach!)

It managed to run within a RAM of ~ 14GB usable at the expense of taking
70 seconds!  My data-structure
wasn't ideal to say the least,  though the initial set of 420 "ops"
generated only ~ 43000 small objects.
The space actually used appears fo be ~9GB:

     7!:2@] 'reboot2 data'

8721760


There must be a better way,  but at least this slow-coach method didn't
need a super-computer!

I might inspect the efficiency,  but probably not - it's taken too long
to find a working solution!

Looking forward to Raul's posting next week!

Cheers,

Mike

On 04/01/2022 13:49, 'Mike Day' via Programming wrote:
As I recall, a killer question until one realises there’s no need to preserve 
the order;  then it’s just a matter of maintaining counts, as you observe.

I’m currently wondering how to acquire the tera- or peta-bytes of storage to 
deal with day 22 part 2.  Part 1 is easy, of course.  No spoilers,  though.  I 
haven’t given up yet!

Cheers,

Mike

Sent from my iPad

On 4 Jan 2022, at 03:06, Raul Miller<rauldmil...@gmail.com>  wrote:

https://adventofcode.com/2021/day/14

For day 14, we were supposed to run a "polymerization sequence" for N
steps, and then find the difference in the quantity between the most
common and least common elements of the sequence.

For part A, we were supposed to run 10 steps. For part B, we were
supposed to run 40 steps.

The sample data looked like this:

.............. [truncated]

--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to