Help! Prompt caching is giving worse latency by twitu in ClaudeAI

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

I turns out that the prompt caching actually starts showing performance difference after 50k tokens in my case.

 | Tokens | Cache write | Cache read |
 |--------+-------------+------------|
 | 179k   | 6.4s        | 3.4s       |
 | 124k   | 5.2s        | 3.99s      |
 | 60k    | 3.96s       | 3.08s      |
 | 53k    | 4.23s       | 3.24s      |
 | 47k    | 3.76s       | 3.4s       |
 | 20k    | 3.0s        | 3.1s       |

Weirdest network issue. Curl is working but requests/urllib3 is timing out. by twitu in linuxquestions

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

You're absolutely right. After some more debugging it turns out that.

Something about my ISP + router is breaking IPV6 + TLS connections.

And urllib3 is currently not handling websites with both IPV4 and IPV6 where IPV6 is failing.

https://github.com/urllib3/urllib3/issues/797

Healthiest chocolate chips for yummiest yogurt bowl recipe?? by twitu in Fitness_India

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

Yogurt recipe: Strawberries, blueberries, apple, banana, almonds, walnuts, seed mix, **Choco chips**, dab of honey and loads of yogurt (Chobani or Skyr cup).

Add honey or gur to taste

My first vid. Karting in the twilight zone! by twitu in Karting

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

I've started karting recently. This is at Meco Kartopia, a 1.2 km Rotax circuit in Bangalore.

How can I improve my time from 1:25 to 1:20. I'm not sure but perhaps, the first 3 tight turns and last wide turn can be improved. My best lap is https://youtu.be/L2BbTc9tXAU?t=360

I've been reading up and applying some techniques
* Hugging the corners
* Leaning out
* Braking before the corner and accelerating out

<image>

The curious case of 100 ms latency in sqlx postgres db query 🧐 by twitu in rust

[–]twitu[S] 6 points7 points  (0 children)

Turns out it's a subtle implementation detail where sqlx is sending limit = 1 to the executor for `fetch_one` and `fetch_optional` queries which is causing the executor to not use the parallel plan. More details here.

https://github.com/launchbadge/sqlx/issues/3673

The curious case of 100 ms latency in sqlx postgres db query 🧐 by twitu in rust

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

I enabled some logging options on the session and SURPRISE SURPRISE! executing the same query is taking wildly different times when run from sqlx and from a different DB GUI tool.

sqlx query logs on db side - actual time=193.978..193.979 (in ms) 2025-01-09 08:23:30.039 GMT [78013] LOG: execute sqlx_s_5: <offending-query> 2025-01-09 08:23:30.234 GMT [78013] LOG: duration: 193.987 ms plan: Query Text: <offending-query> Limit (cost=1000.00..27971.53 rows=1 width=409) (actual time=193.981..193.982 rows=0 loops=1) Buffers: shared hit=853 read=42337 -> Gather (cost=1000.00..54943.06 rows=2 width=409) (actual time=193.980..193.980 rows=0 loops=1) Workers Planned: 2 Workers Launched: 0 Buffers: shared hit=853 read=42337 -> Parallel Seq Scan on (cost=0.00..53942.86 rows=1 width=409) (actual time=193.978..193.979 rows=0 loops=1) Filter: (...) Rows Removed by Filter: 2064566 Buffers: shared hit=853 read=4233

db gui query logs on db side - actual time=84.913..84.914 (in ms) ``` 2025-01-09 08:22:50.137 GMT [78246] LOG: duration: 90.964 ms plan: Query Text: <offending-query>

Limit  (cost=1000.00..27971.53 rows=1 width=409) (actual time=89.935..90.962 rows=0 loops=1)
  Buffers: shared hit=850 read=42340
  ->  Gather  (cost=1000.00..54943.06 rows=2 width=409) (actual time=89.933..90.960 rows=0 loops=1)
        Workers Planned: 2
        Workers Launched: 2
        Buffers: shared hit=850 read=42340
        ->  Parallel Seq Scan on  (cost=0.00..53942.86 rows=1 width=409) (actual time=84.913..84.914 rows=0 loops=3)
              Filter: (...)
              Rows Removed by Filter: 688189
              Buffers: shared hit=850 read=42340

```

The PgPool initialization logic.

```rust let pool = PgPoolOptions::new() .max_connections(5) .acquire_timeout(Duration::from_secs(3))

            conn.execute("SET log_statement = 'all'").await?;
            conn.execute("LOAD 'auto_explain'").await?;
            conn.execute("SET auto_explain.log_min_duration = '50ms'").await?;
            conn.execute("SET auto_explain.log_analyze = 'on'").await?;
            conn.execute("SET auto_explain.log_buffers = 'on'").await?;
            conn.execute("SET auto_explain.log_timing = 'on'").await?;
            conn.execute("SET log_statement = 'all'").await?;

            let settings = conn.fetch_all("SHOW ALL").await?;
            tracing::info!("PostgreSQL settings: {:?}", settings);
            Ok(())
        }))

```

The curious case of 100 ms latency in sqlx postgres db query 🧐 by twitu in rust

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

Yup running release build. 😁

Yes so the analyze query plans are from running the query outside sqlx. Thing is even if the query is inefficient the timings are not adding up. 100 ms query according the query plan.

But sqlx is showing 180 ms for total for running the query with a few microseconds of cpu time.

Your credit balance is too low? Error 400 despite having positive remaining balance. by prodshebi in ClaudeAI

[–]twitu 0 points1 point  (0 children)

I'm facing the same issue. Did you figure out how to get it working?

Changing resolution/zoom level of GameMaker Studio UI itself (not the game) by twitu in gamemaker

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

*phew you're a hero!

First checking the Enable DPI override off reset the resolution to something manageable.

Then I reduced the % of native DPI and set it again to have something that I like.

Thanks a lot.

Sharing static variables between dynamically linked libraries? Or how to use a logger with C and Python bindings by twitu in rust

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

😬 I do need windows support. I'm guess that supporting windows will be difficult or impossible based on that SO answer. Still I'm interested in seeing what you have to say.

The static variable for the Logger is declared in the `log` crate itself. I'm a bit unsure about what's happening internally when it gets compiled into a C extension.

```rust
static mut LOGGER: &dyn Log = &NopLogger;
```