HackerTrans
TopNewTrendsCommentsPastAskShowJobs

tidwall

no profile record

Submissions

Show HN: Pogocache – Fast caching software

github.com
93 points·by tidwall·12 mesi fa·29 comments

Show HN: Bgen – B-tree generator for C

github.com
5 points·by tidwall·2 anni fa·1 comments

Show HN: Neco – Coroutine Library for C

github.com
145 points·by tidwall·2 anni fa·36 comments

comments

tidwall
·3 mesi fa·discuss
Looks to me like having the ability to write Go syntax and interop directly with C is the plus.
tidwall
·3 mesi fa·discuss
"To keep things simple, there are no channels, goroutines, closures, or generics."

I wonder if it could be integrated with https://github.com/tidwall/neco, which has Go-like coroutines, channels, and synchronization methods.
tidwall
·4 mesi fa·discuss
I do this all the time. I’ll spend weeks or months on a project, with thousands of wip commits and various fragmented branches. When ready, I’ll squash it all into a single initial commit for public consumption.
tidwall
·6 mesi fa·discuss
This reminds me of a card swiping video game system I made years ago.

https://youtu.be/Z2xq3ns5Hsk

https://github.com/tidwall/RetroSwiper
tidwall
·7 mesi fa·discuss
Or this.

    func fetchUser(id int) (user User, err error) {
        resp, err := http.Get(fmt.Sprintf("https://api.example.com/users/%d", id))
        if err != nil {
            return user, err
        }
        defer resp.Body.Close()
        return user, json.NewDecoder(resp.Body).Decode(&user)
    }
tidwall
·9 mesi fa·discuss
A bird in the hand.
tidwall
·12 mesi fa·discuss
Thanks! The Pogocache sharded hashmap design is optimized for extremely low contention and good memory locality. It super rare for any two threads to ever wait on the same key. That's the biggest part and it's all in the src/pogocache.c file. But the network layer is finely tuned too.

Mostly I perfed and profiled ad nauseam, monitoring cpu cycles along the way. I found that keeping a focus on latency and cycles was primo, and the rest fell into place.
tidwall
·12 mesi fa·discuss
Thanks!
tidwall
·12 mesi fa·discuss
Like an ACL file?
tidwall
·12 mesi fa·discuss
Thanks you for the blog post about TG when it came out.
tidwall
·12 mesi fa·discuss
Glad to bring another one into this world.
tidwall
·12 mesi fa·discuss
The protocols are autodetected. No need to carry multiple ports around.
tidwall
·12 mesi fa·discuss
Oh wow. That is dope. Thanks for sharing.
tidwall
·12 mesi fa·discuss
Thanks Steve. Your feedback was very helpful.
tidwall
·12 mesi fa·discuss
No
tidwall
·12 mesi fa·discuss
Yes, it is highly hand optimized. There's a description of some of the methods I used near the bottom of there README. I mainly focused on minimizing contention, with the sharded hashmap and such. But the networking layer is carefully crafted.
tidwall
·12 mesi fa·discuss
Not intending to make pogocache into a sql database. I prefer keeping it a cache. More so exploring ways to work with existing databases such as sqlite, duckdb, postgres. Kinda like providing proxy-ish operations that transparently cache sql reads.
tidwall
·12 mesi fa·discuss
That's the only way right now. The other ways I'm considering is with an environment variable and/or acl.
tidwall
·12 mesi fa·discuss
I updated the graphs to use linear scaling. Thanks for the feedback
tidwall
·12 mesi fa·discuss
Memcache binary protocol was deprecated years ago. It’s no longer recommended to be used.