TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: A LRU cache using go generics

57 pointsby _256over 3 years ago

2 comments

_256over 3 years ago
This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)
评论 #29925230 未加载
评论 #29924929 未加载
morelispover 3 years ago
&gt; Feedback is welcome<p>You&#x27;ll probably be a lot better off a) preallocating the elements so your memory is nicely contiguous, b) tracking indices and not pointers. If I wanted to pay 24b overhead per item I&#x27;d use an `interface{}`. :)
评论 #29927326 未加载
评论 #29932246 未加载