Readit News logoReadit News
destel commented on Nano Banana image examples   github.com/PicoTrex/Aweso... · Posted by u/SweetSoftPillow
AstroBen · 3 months ago
I just tried it for an app I'm working on.. very bad results
destel · 3 months ago
I had similar bad results with gpt 4o/5 when they got these image generation capabilities.

Don’t know what’s the reason: my bad prompting or these models being tuned to work with photos/illustrations only

destel commented on Nano Banana image examples   github.com/PicoTrex/Aweso... · Posted by u/SweetSoftPillow
destel · 3 months ago
Some examples are mind blowing. It’s interesting if it can generate web/app designs
destel commented on Preserving Order in Concurrent Go Apps: Three Approaches Compared   destel.dev/blog/preservin... · Posted by u/destel
gabesullice · 3 months ago
I might be too late for you to see this, but I'm curious why your final example requires the function "f" to receive the canWrite channel. I must be missing something. Couldn't the Ordered map signature be:

  func OrderedLoop[A, B any](in <-chan A, done chan<- B, n int, f func(a A))
Instead of:

  func OrderedLoop[A, B any](in <-chan A, done chan<- B, n int, f func(a A, canWrite <-chan struct{}))
Or is there a reason that "f" can't be wrapped in an anonymous function to handle the blocking logic?

destel · 3 months ago
You're not late. Just yesterday I've configured new reply notifications via RSS.

Typically function "f" does two things. 1. Performs calculations (this can be parallelized). 2. Writes results somewhere (this must happen sequentially and in the correct order).

Here's the typical OrderedLoop usage example from the article:

  OrderedLoop(in, out, n, func(a A, canWrite <-chan struct{}) {
   // [Do processing here]
   
   // Everything above this line is executed concurrently,
   // everything below it is executed sequentially and in order
   <-canWrite
   
   // [Write results somewhere]
  })

Without the "canWrite" the entire body of the "f" will be executed either concurrently or sequentially. With it - we can have this dual behavior, similar to critical sections protected by mutexes.

It's worth mentioning that OrderedLoop is a low-level primitive. User-level functions like OrderedMap, OrderedFilter and others do not need the "canWrite" channel to be exposed.

destel commented on Preserving Order in Concurrent Go Apps: Three Approaches Compared   destel.dev/blog/preservin... · Posted by u/destel
kunley · 4 months ago
chan chan Foo seems like a cool trick, looking forward to use it in the code; thanks for the idea.

PS. I realize you present even better solution; still, first version seems like a thing nice enough to have in a toolbox

destel · 4 months ago
Thanks. This replyTo pattern is very similar to promises in other languages.
destel commented on Preserving Order in Concurrent Go Apps: Three Approaches Compared   destel.dev/blog/preservin... · Posted by u/destel
destel · 4 months ago
UPD.

I've just made a small but important clarification to the article. While in many cases it's easier and even preferred to calculate all results, accumulate them somewhere, then sort; this article focuses on memory bound algorithms that support infinite streams and backpressure.

destel commented on Preserving Order in Concurrent Go Apps: Three Approaches Compared   destel.dev/blog/preservin... · Posted by u/destel
latchkey · 4 months ago
For something like this, I would instinctively reach for an external queue mechanism instead of trying to work through the complexity of golangs concurrency.

Create a bunch of sequentially numbered jobs that then update their output into postgres database. Then have N number of workers process the jobs. Something like GCP's CloudTasks is perfect for this because the "workers" are just GCP Cloud Functions, so you can have a near infinite number of them (limited by concurrent DB connections).

This approach also buys you durability of the queue for free (ie: what happens when you need to stop your golang process mid queue?).

Then it is just a query:

  select * from finished_jobs order by job_num;

destel · 4 months ago
I've just made a small but important clarification to the article. While in many cases it's easier and even preferred to calculate all results, accumulate them somewhere, then sort; this article focuses on memory bound algorithms that support infinite streams and backpressure.

u/destel

KarmaCake day122November 25, 2024View Original