gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commite5c9b659e5c9b659Pack retained search IDs into UTF-8 bytesmree5c9b659/lib/catalog-list.hl

1.1 KB

  1. // UTF-8 ID/key pairs with numeric boundaries. length uses the catalog's two slots per row.
  2. payload = toBytes(0)
  3. bounds = []
  4. length = 0
  5. waste = 0
  6. fetch(Number i) {
  7. row = (i - i % 2) / 2
  8. at = row * 3 + i % 2
  9. return payload.text(bounds[at], bounds[at + 1])
  10. }
  11. insert(Number i, String id, String key) {
  12. a = toBytes(id)
  13. b = toBytes(key)
  14. start = payload.length
  15. payload.append(&a)
  16. middle = payload.length
  17. payload.append(&b)
  18. at = i / 2 * 3
  19. bounds.splice(at, 0, payload.length)
  20. bounds.splice(at, 0, middle)
  21. bounds.splice(at, 0, start)
  22. length = length + 2
  23. return null
  24. }
  25. remove(Number i) {
  26. at = i / 2 * 3
  27. waste = waste + bounds[at + 2] - bounds[at]
  28. bounds.splice(at, 3)
  29. length = length - 2
  30. if (waste > 1048576 && waste * 2 > payload.length) { compact() }
  31. return null
  32. }
  33. compact() {
  34. out = toBytes(0)
  35. for (let i = 0; i < bounds.length; i = i + 3) {
  36. id = toBytes(payload.text(bounds[i], bounds[i + 1]))
  37. key = toBytes(payload.text(bounds[i + 1], bounds[i + 2]))
  38. bounds[i] = out.length
  39. out.append(&id)
  40. bounds[i + 1] = out.length
  41. out.append(&key)
  42. bounds[i + 2] = out.length
  43. }
  44. payload = out
  45. waste = 0
  46. return null
  47. }

Branches

Latest commits

  • e5c9b659Pack retained search IDs into UTF-8 bytesmre
  • 62a5f6c7HM67 brief, HM66 mergedmre
  • b32b8440Merge hm66-catalogindex: packed catalog indexmre
  • 2db0f7adReport HM66 heap measurements and validationmre
  • 6ce15623Pack catalog lists and membership maps in UTF-8 bytesmre
  • 71134e21HM66 briefmre
  • ed4cbab2status timemre
  • e982c26dlog: HM65 mergedmre
  • 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
  • 07a5c883HM65 report measured field projection and complete validationmre
  • 0eab858fRead only catalog date fields during the episode boot scanmre
  • d3179273log: HM65 hl:heap vendoringmre
  • cb78a1a0HM65 report missing heap diagnostic package with repromre
  • 89606a5cHM65 briefmre
  • 096ce0d4log: DP69 live on day48mre
  • b3d8a80bDP69 brief, RV48 mergedmre
  • ce6d7d32Merge rv48: Hybriel day48mre
  • 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
  • 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
  • 4a802ae7status: RV48 runningmre