c4-project / c4t

Runs concurrent C compiler tests
MIT License
1 stars 0 forks source link

Consider XML for plan files #125

Open MattWindsor91 opened 3 years ago

MattWindsor91 commented 3 years ago

But Matt, it's 2021! Nobody uses XML anymore!

The more I think about how plan files work, the more I'm convinced XML might actually be a better fit than JSON. To wit:

Plan metadata

The first key in the plan is the metadata:

"metadata": {
  "created": "2021-01-05T09:09:28.556225918Z",
  "seed": 1609837768556225918,
  "version": 20210127,
  "stages": []
}

All of this, except the stages, is an auxiliary detail of the plan, and we could put it in the attributes of the root node:

<plan created="2021-01-05T09:09:28.556225918Z" seed="1609837768556225918" version="20210127">
</plan>

Stages could be a lot simpler than they are atm: from

{
"stages": [
  {
    "stage": "Plan",
    "completed_on": "2021-01-04T16:30:49.355106881Z",
    "duration": 68349693018
  }
]
}

to

<stages>
  <stage id="Plan" completed_on="2021-01-04T16:30:49.355106881Z" duration="68349693018" />
</stages>

States

{
  "tag": "counter",
  "values": {
    "0:r0": "0",
    "0:r1": "0",
    "1:r0": "0",
    "2:r0": "1",
        "x": "0"
    }
},

A fantasy encoding in xml might look like this:

<state tag="counter">
  <mapping tid="0" var="r0" value="0" />
  <mapping tid="0" var="r1" value="0" />
  <mapping tid="1" var="r0" value="0" />
  <mapping tid="2" var="0" value="1" />
  <mapping var="x" value="0" />
</state>

Not much less compact than what we've got at the moment; splitting the TIDs and vars out like this in JSON would be a nightmare of encoding space.