gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2e1b116f2e1b116ftickets: re-vendor Hybriel master acaceaf3 (framework ec8d6c1d): plugins/web patch queue while a page is built, anonymous session cookies refresh; gate waits for the comment editors to draw (W174) and clicks the form editor when it stands still; security gate: main's code runs on its own binary, lazy-session cookie checksmre2e1b116f/plugins/mpackdb/bench_open.zig

4.0 KB

  1. // Mission 436 bench: open/close timing and index dump of an mpackdb store.
  2. // bench_open gen <dbfile> <n> write a synthetic store (pk '@id' 24-hex, '!oldId' 24-hex), no index files
  3. // bench_open open <dbfile> time open + close (schema @id, !oldId, compact=false)
  4. // bench_open dump <dbfile> <out> open and write every index entry (field,key,off,len) to <out>
  5. const std = @import("std");
  6. const msgpack = @import("msgpack.zig");
  7. const engine = @import("engine.zig");
  8. const linux = std.os.linux;
  9. fn nowNs() i128 {
  10. var ts: linux.timespec = undefined;
  11. _ = linux.clock_gettime(linux.CLOCK.MONOTONIC, &ts);
  12. return @as(i128, ts.sec) * 1_000_000_000 + ts.nsec;
  13. }
  14. pub fn main(init: std.process.Init) !void {
  15. const gpa = init.gpa;
  16. var iter = std.process.Args.Iterator.init(init.minimal.args);
  17. _ = iter.next();
  18. const cmd = iter.next() orelse return;
  19. const dbfile = iter.next() orelse return;
  20. if (std.mem.eql(u8, cmd, "gen")) {
  21. const n = try std.fmt.parseInt(usize, iter.next().?, 10);
  22. var base: []const u8 = dbfile;
  23. if (std.mem.endsWith(u8, base, ".db")) base = base[0 .. base.len - 3];
  24. const path = try std.fmt.allocPrintSentinel(gpa, "{s}.mpack", .{base}, 0);
  25. const fd: i32 = @bitCast(@as(u32, @truncate(linux.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, 0o644))));
  26. var out: std.ArrayList(u8) = .empty;
  27. var prng = std.Random.DefaultPrng.init(42);
  28. const r = prng.random();
  29. var arena_state = std.heap.ArenaAllocator.init(gpa);
  30. var i: usize = 0;
  31. while (i < n) : (i += 1) {
  32. _ = arena_state.reset(.retain_capacity);
  33. const a = arena_state.allocator();
  34. const id = try std.fmt.allocPrint(a, "{x:0>16}", .{r.int(u64)});
  35. const old = try std.fmt.allocPrint(a, "60f2{x:0>8}{x:0>12}", .{ r.int(u32), i });
  36. const entries = try a.alloc(msgpack.Entry, 4);
  37. entries[0] = .{ .key = .{ .str = "id" }, .value = .{ .str = id } };
  38. entries[1] = .{ .key = .{ .str = "oldId" }, .value = .{ .str = old } };
  39. entries[2] = .{ .key = .{ .str = "name" }, .value = .{ .str = "Some Person Name" } };
  40. entries[3] = .{ .key = .{ .str = "n" }, .value = .{ .number = @floatFromInt(i) } };
  41. const framed = try msgpack.serialize(a, .{ .map = entries });
  42. try out.appendSlice(gpa, framed);
  43. if (out.items.len > 1 << 20) {
  44. _ = linux.write(fd, out.items.ptr, out.items.len);
  45. out.clearRetainingCapacity();
  46. }
  47. }
  48. _ = linux.write(fd, out.items.ptr, out.items.len);
  49. _ = linux.close(fd);
  50. return;
  51. }
  52. const t0 = nowNs();
  53. const db = try engine.Db.open(gpa, dbfile, .{ .primary_key = "@id", .indexes = &.{"!oldId"}, .compact = false });
  54. const t1 = nowNs();
  55. if (std.mem.eql(u8, cmd, "dump")) {
  56. const outp = try std.fmt.allocPrintSentinel(gpa, "{s}", .{iter.next().?}, 0);
  57. var buf: std.ArrayList(u8) = .empty;
  58. var it = db.idx.iterator();
  59. while (it.next()) |kv| {
  60. for (kv.value_ptr.entries.items) |e| {
  61. var kb: [40]u8 = undefined;
  62. const ks = switch (e.key) {
  63. .num => |x| engine.jsNumFmt(&kb, x),
  64. .str => |s| s,
  65. };
  66. const line = try std.fmt.allocPrint(gpa, "{s}\t{s}\t{d}\t{d}\n", .{ kv.key_ptr.*, ks, e.off, e.len });
  67. defer gpa.free(line);
  68. try buf.appendSlice(gpa, line);
  69. }
  70. }
  71. const fd: i32 = @bitCast(@as(u32, @truncate(linux.open(outp, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, 0o644))));
  72. var off: usize = 0;
  73. while (off < buf.items.len) {
  74. const rc = linux.write(fd, buf.items.ptr + off, buf.items.len - off);
  75. off += rc;
  76. }
  77. _ = linux.close(fd);
  78. }
  79. const t2 = nowNs();
  80. db.close();
  81. const t3 = nowNs();
  82. std.debug.print("open {d} ms, close {d} ms\n", .{ @divTrunc(t1 - t0, 1_000_000), @divTrunc(t3 - t2, 1_000_000) });
  83. }

Branches

Latest commits

  • 2e1b116ftickets: re-vendor Hybriel master acaceaf3 (framework ec8d6c1d): plugins/web patch queue while a page is built, anonymous session cookies refresh; gate waits for the comment editors to draw (W174) and clicks the form editor when it stands still; security gate: main's code runs on its own binary, lazy-session cookie checksmre
  • 361bc0fetickets: re-vendor Hybriel 7a684920 (WIP, not deployed); on Error exits 1 at startup; migrate passes its log by reference; gate checks follow lazy sessions and the 413 refusalmre
  • 8a69999cident#28: /login/callback never signs out the session it finds; a valid code puts the user on the same sessionmre
  • 337e9b21tickets#37: a comment's files are open to everyone who can read the commentmre
  • 1800600ftickets: write the standby service out in full so the boot gate can read the main servicemre
  • 8179d287tickets: standby service on its port plus 10 and a deploy that hands over through it without a gapmre
  • 0398145ctickets: the table grid rule is marked functional for check-thememre
  • 40fddc20tickets takes components e54f83a: tables get thin grey lines from the theme, desktop toolbar stays one row with the Table button, F4 check counts 11 buttonsmre
  • c1b77d61tickets#35: text typed before the editor is built is taken in once by the build (the input handler no longer writes it to the field first, which doubled the first letters); the gate failure shows the surfacemre
  • 32bf1873tickets#35: the gate types right after the load with the CPU slowed, no waitingmre
  • 64ea9ca2tickets#35: text typed into the reply editor before the page has finished starting is kept; the gate types right after loadmre
  • ccd3a327tickets: the security gate expects frame-src to be exactly the ident address (the sign-in frame), still no wildcard or selfmre
  • 4348dbabident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • 66ef3005Merge branch 'iw-ident-widget'mre
  • bc0ad663tickets: a gap between your name and Log out in the phone header (they touched); gate checks itmre
  • 2f818d46UX2: report, LOG line, e2e fixes, gate pause after loadmre
  • af3ef7c4gate: the legacy state line says progressmre
  • 62480a00tickets#33: a state change with a note is a comment card in the feed (same framework rendering, can be liked, edited, deleted), its state line stands alone; gate checks for a new comment with and without a state change, at once and after a reloadmre
  • 4ae80007UX: Respond is one composer (state in its footer, button says what happens); New ticket / New project windows in the list heading row; project form shared; theme copied from layouts; gates and a lisbeth e2emre
  • f03b438atickets header: the selector alone top right plus your name and Log out as before the theme missions; the user icon is gonemre