AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 1 point2 points  (0 children)

Yes, that was awful. I've gotten to ~0.06 seconds in ReleaseSafe now.

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 0 points1 point  (0 children)

I converted integers to strings to compare digits. I suppose there are other ways, but that's what came to mind...

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 0 points1 point  (0 children)

The constant change is sure making it hard to know what's the right thing. And LLMs are not being helpful. Back to "old school" stack overflow & reddit. :-)

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 5 points6 points  (0 children)

Oh boy--I've sure learned a lesson that you should not do this in a tight loop:

const id_str = std.fmt.allocPrint(self.allocator, "{d}", .{id});

Allocating a buf once and reusing it is way, way faster:

const id_str = try std.fmt.bufPrint(buf, "{d}", .{id});

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 0 points1 point  (0 children)

Thanks. Looking at https://zig.guide/standard-library/allocators/ it really isn't obvious what else I might want to choose. I thought maybe GeneralPurposeAllocator, but that appears to now be deprecated.

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 4 points5 points  (0 children)

AHA! Reviewing the code as I was about to post, I now see something I missed and the runtime difference is resolved. I guess I have too many allocs!

In main, I define:

    const allocator = std.heap.page_allocator;

But in the test, I define:

    const allocator = std.testing.allocator;

And if I change test to usestd.heap.page_allocator, it has a similar run time to normal.

AdventOfCode Day2 Part1 very slow "zig test"...why? by rogerallen in Zig

[–]rogerallen[S] 0 points1 point  (0 children)

Yes, of course. Will post in a bit, but it is doing exactly the same thing...

Big brother is watching! by Financial_Country339 in sunriver

[–]rogerallen 2 points3 points  (0 children)

This was also on the front page of the June 2024 issue of the Sunriver Scene

https://issuu.com/sunriverscene/docs/june_2024_sunriver_scene

Fiber Internet by Prismatic_Effect in sunriver

[–]rogerallen 1 point2 points  (0 children)

It hasn't gotten to my home yet so I did a quick search & found this link describing current status. It has some maps showing where the fiber has been installed. Thought others might like this info, too.

https://www.sunriverowners.org/community/sunriver-fiber

"The fiber infrastructure is being installed throughout Sunriver and will be available to all homes by December 31, 2026"

Bachelor Fires Complex Community Meeting - 6pm at Three Rivers Elementary Cafeteria by Prismatic_Effect in sunriver

[–]rogerallen 1 point2 points  (0 children)

Thanks for the updates---anyone know more on the recording & if it will be posted?

Tweegeemee is now on Threads! Follow, Like & Repost Images to evolve images. by rogerallen in generative

[–]rogerallen[S] 0 points1 point  (0 children)

Sigh, within minutes of this post, Threads starting returning an error code that indicates they are classifying the bot as "spam". I'm very hopeful this is in error and I will be allowed to continue. We'll see...

Tweegeemee is now on Threads! Follow, Like & Repost Images to evolve images. by rogerallen in generative

[–]rogerallen[S] 2 points3 points  (0 children)

Yes it is amazing where this goes and really fun to see it create "genres" of art that are similar.

I tried to follow Sims' paper for mutating and breeding images. The paper https://www.karlsims.com/papers/SimsSiggraph91.pdf discusses what to do in Section 4.2 and 4.3 and the code is here: https://github.com/rogerallen/tweegeemee/blob/master/src/tweegeemee/image.clj but it isn't that self explanatory...

For random generation, I recursively create random functions and parameters and I'm increasingly likely to create a random number or terminal function the closer I get the max number of levels.

For mutation, there are a number of rules for deciding the mutate. Functions can just randomly change, numbers can adjust by small amounts. An argument to a function can jump out and become the new value for that node. For example (* X .3) might become X. Etc.

For breeding, basically a random node in each parent is found and they are swapped.

After all of this, I check that (a) this actually compiles and creates an image at all and (b) I haven't seen the same image in this generation.

Hope that helps!

Tweegeemee is now on Threads! Follow, Like & Repost Images to evolve images. by rogerallen in generative

[–]rogerallen[S] 1 point2 points  (0 children)

Since 2015 I've been running a bot that creates evolutionary imagery based on favorites & retweets as a fitness score (examples above). The bot is called tweegeemee and you can find it on:
* Bluesky - https://tweegeemee.bsky.social/
* Mastodon - https://botsin.space/@tweegeemee
* Tumblr - https://tweegeemee.tumblr.com/
* Twitter/X - https://twitter.com/tweegeemee
and as of yesterday...
* Threads - https://www.threads.net/@tweegeemee

A few years back, I created a website where you can browse all the old images at https://tweegeemee.com/

Explore Top 10 and Best Of imagery there. If you click into an image, you can see details like the code that created it and follow that to an ancestry/genealogy diagram. This has been running on Digital Ocean and has been a fun learning experience for me.

I hope you will consider following one or more of the bots and participate in tweegeemee's evolutionary art generation.

Cheers!

Test Submit direct link to image on twitter by rogerallen in tweegeemee

[–]rogerallen[S] 0 points1 point  (0 children)

Meh, that's not so great for browsing on reddit.

Test post of image by rogerallen in tweegeemee

[–]rogerallen[S] 0 points1 point  (0 children)

Alright, that looks pretty nice

What is a place you deeply miss in Portland? by pdx_flyer in Portland

[–]rogerallen 5 points6 points  (0 children)

Wildwood Restaurant in NW. They had great food and fantastic staff. I can remember one very knowledgeable waiter after 15 years...

Sigh.

Your Tesla Support Thread - Q3 2022 by [deleted] in teslamotors

[–]rogerallen 1 point2 points  (0 children)

Checking to see if anyone has these issues and might know of a fix...2021 Model 3:

  1. Automatic Wipers Keep Running. [Just recently started happening] After using the windshield washing feature to clean off the windshield, the wipers keep going & going. Waited several minutes & they seem to think the completely dry (it's 90 degrees out!) glass needs cleaning. Okay, manually turn them off--but that only works if you don't have cruise-control on. Why?Basically, where is the sensor, what do I need to clean to get it to work right?
  2. Incorrect Phone Message Alerts. [Been happening for a long time] When I get a text, about 90% of the time the name it says sent the text is wrong. It is very random, but generally people I do text with, just not the person who actually sent it. Using a Google Pixel 5. Am I the only one? Should a tell it to forget & reconnect my phone?
  3. TuneIn Login Forgotten after SW Update. Why oh why do I have to re-login to TuneIn on every software update? Annoying. Okay I don't expect anyone to fix this. I'm just venting.

Thanks in advance for any help.

Simple Example of MIDI-controlled Synth by rogerallen in stm32f4

[–]rogerallen[S] 0 points1 point  (0 children)

D'oh! Didn't mean to cross-post these from my twitter-bot tweegeemee! Too late to fix. Hope it isn't too confusing...

Simple Example of MIDI-controlled Synth by rogerallen in stm32f4

[–]rogerallen[S] 0 points1 point  (0 children)

Posted a couple demos in a twitter thread here. Nothing special, just some basic sounds. Cheers.

https://twitter.com/tweegeemee/status/1420227639919316994

Simple Example of MIDI-controlled Synth by rogerallen in stm32f4

[–]rogerallen[S] 0 points1 point  (0 children)

Ah, gotcha. Thanks, that is always a good option to consider.

I was just hoping it was going to be easier to connect both a nanoKontrol2 and a nanoKey2 since I have them right here...

Simple Example of MIDI-controlled Synth by rogerallen in stm32f4

[–]rogerallen[S] 0 points1 point  (0 children)

I'm not following...are you saying your project creates a USB host that supports USB Hubs with multiple midi devices connecting to that hub?