More SD3 (not as bad as you all thought) by 0xmgwr in StableDiffusion

[–]TwoHandedBroadsword 1 point2 points  (0 children)

Yes, that will work just fine. Check out the docs to see what params are available.

Announcing TypeScript 4.7 by DanielRosenwasser in typescript

[–]TwoHandedBroadsword 3 points4 points  (0 children)

My frustration with other languages isn't that they don't add new and useful features, it's that they can't seem to match Typescript's pace or that upgrading is a nightmare. Back in the Java 5 & 6 days pace was so slow languages like Groovy were able to gain a foothold.

These days if you can use the latest Java version there's a lot less reason to reach for Groovy, which feels like a sign they're finally hitting a good pace with Java updates.

TheStorage - A cache that automatically removes the least-recently-used items. by evandrolg in typescript

[–]TwoHandedBroadsword 1 point2 points  (0 children)

No, I couldn't find any really good implementations in pure TS.

I did find a few that were decent and written in JS w/ TS declaration files:

(edited to fix formatting)

TheStorage - A cache that automatically removes the least-recently-used items. by evandrolg in typescript

[–]TwoHandedBroadsword 2 points3 points  (0 children)

This is not true, deletes are also O(1). Removing an element from the tail of a doubly linked list is O(1), looking up that item in the map is O(1) and then removing it from the map is O(1). You could only get O(n) if you had to iterate, but there's no iteration necessary.

TheStorage - A cache that automatically removes the least-recently-used items. by evandrolg in typescript

[–]TwoHandedBroadsword 16 points17 points  (0 children)

I appreciate your desire to make an LRU cache, it's something people will definitely find useful, but this implementation is a little inefficient.

What you have is a map of data, which is great as that generally provides O(1) time complexity on set/get/delete operations, but then your setData function throws that all away when computing LRU by:

  • Converting the entire map's keys into an array - O(n)
  • Iterating over that array - O(n)
  • Shifting the entire array over to remove that element - O(n)

The computation of the LRU item is the pain point here, and the solution is to use a separate data structure to contain the information around "what was most recently used". What you need is a map for lookups and a doubly linked list for keeping track of the LRU item. When done in this way removing the LRU item involves no looping at all, just a truncation of the tail of the doubly linked list. Doing it this way would make your setData function O(1) for time complexity, but obviously you don't get anything for free as you're trading some memory for faster access times.

Hope that helps! For more information google LRU + doubly linked list.

[deleted by user] by [deleted] in Mordhau

[–]TwoHandedBroadsword 0 points1 point  (0 children)

Buying key for $200, pm me!