Skip to content

The state of this project #206

@MarcellPerger1

Description

@MarcellPerger1

I don't really want to abandon this project. However the state of affairs is currently:

  • For a significant part of the year, I have very limited free time to work on any personal programming projects

  • I have a ton of project ideas I want to do and I don't think this is the most impressive (e.g. for a CV)

  • I don't remember quite a few parts of this project:

    • Some code is like:
      I have no memory of this place
    • e.g. With this part of the test code, I had no clue it existed, it was only when I saw the usage that I was like 'uhh... maybe I have some very faint memory of this code existing?'
      class InitiatorFormatter {
      constructor() {
      this.s = "";
      this.currIndent = 0;
      }
      reset() {
      this.s = "";
      this.currIndent = 0;
      }
      fmt(/** @type {ppt.HTTPRequest} */ req) {
      this.reset();
      this._fmt(req);
      return this.s;
      }
      print(/** @type {ppt.HTTPRequest} */ req) {
      console.log(this.fmt(req));
      }
      _fmt(/** @type {ppt.HTTPRequest} */ req) {
      let ini = req.initiator();
      if (!ini) return this.println("Initiator unknown");
      this.println("Initiator info:");
      this.indented(() => {
      this.println(`Type: ${ini.type}`);
      this.fmtURL(ini);
      if (ini.requestId) this.println(`Initiator request ID: ${ini.requestId}`);
      if (ini.stack) this.fmtAllStacks(ini.stack);
      });
      }
      indented(/** @type {() => void} */ callback) {
      this.currIndent += 2;
      callback();
      this.currIndent -= 2;
      }
      getIndent(/** @type {boolean} */ doIndent) {
      return doIndent ? " ".repeat(this.currIndent) : "";
      }
      println(/** @type {string} */ line, { doIndent = true } = {}) {
      this.s += this.getIndent(doIndent) + line + "\n";
      }
      beginLine(/** @type {string} */ s = "", { doIndent = true } = {}) {
      this.s += this.getIndent(doIndent) + s;
      }
      endLine(/** @type {string} */ s = "") {
      this.s += s + "\n";
      }
      fmtURL(/** @type {InitiatorT} */ ini) {
      if (!ini.url) return;
      // stringifyLocation uses .url, .columnNumber, .lineNumber
      this.println(`Initaitor location: ${this.stringifyLocation(ini)}`);
      }
      getNumStacks(/** @type {StackTraceT} */ base) {
      let curr = base;
      let i = 0;
      while (curr) {
      if (i >= 10_000) return null;
      i++;
      curr = curr.parent;
      }
      return i;
      }
      fmtAllStacks(/** @type {StackTraceT} */ stack) {
      this.println("Initiator stack:");
      let i = 0;
      this.indented(() => {
      let curr = stack;
      for (; i < 8 && curr; i++) {
      this.fmtSingleStack(curr, i);
      curr = curr.parent;
      }
      });
      this.fmtMoreStacksMsg(stack, /*nDisplayed*/ i);
      }
      fmtMoreStacksMsg(
      /** @type {StackTraceT} */ base,
      /** @type {number} */ nDisplayed
      ) {
      if (nDisplayed < 8) return;
      let nStacksTotal = this.getNumStacks(base);
      this.println(
      `(And ${nStacksTotal ? nStacksTotal - nDisplayed : "9999+"} more stacks)`
      );
      }
      fmtSingleStack(/** @type {StackTraceT} */ stack, /** @type {number} */ i) {
      this.println(`Stack ${i} (${stack.description ?? "<no description>"}):`);
      this.indented(() =>
      stack.callFrames.forEach(this.fmtStackFrame, /*thisArg*/ this)
      );
      }
      fmtStackFrame(/** @type {ppt.Protocol.Runtime.CallFrame} */ frame) {
      if (frame.functionName)
      this.println(
      `at ${frame.functionName} (${this.stringifyLocation(frame)})`
      );
      else this.println(`at ${this.stringifyLocation(frame)}`);
      }
      /**
      * Stringify a location using its `.url`, `.lineNumber` and `.columnNumber` properties
      */
      stringifyLocation(/** @type {LocationObjT} */ location) {
      let url = location.url || "<unknown>";
      let lineno = location.lineNumber == null ? null : location.lineNumber + 1;
      let colno =
      location.columnNumber == null ? null : location.columnNumber + 1;
      return (
      lineno && colno ? `${url}:${lineno}:${colno}`
      : lineno ? `${url}:${lineno}`
      : `${url}`
      );
      }
      }
      function fmtInitiatorInfo(/** @type {ppt.HTTPRequest} */ req) {
      return new InitiatorFormatter().fmt(req);
      }
  • There are so many things I'd do differently:

    • Use Typescript from the beginning
    • Use actually efficient vertex generation: insert into correct indices and don't constantly resize; only rebuild a single bit not the entire chunk
    • Pass tex idx rather than explicit tex coords to vertex shader
    • Actually select what to put into the VCS (to be honest, this was the first time I used Git) and don't commit the entire node_modules!!!
    • More webgl utils
    • Don't even attempt the texcoord hacking but fix the problem properly
    • Controversial opinion: don't use Jest (so much can go wrong with the un-vanilla ultra-weird completely unncecessary VM loaders)

So this project will most likely not see significant development for a few months or few years (though I do want to get this project to a slightly better state at some unspecified point in the future, probably starting with a large refactoring)

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions