the-benchmarker / web-frameworks

Which is the fastest web framework?
MIT License
6.97k stars 660 forks source link

Add schema version in extracted data #4237

Open SuspiciousLookingOwl opened 3 years ago

SuspiciousLookingOwl commented 3 years ago

Since it's possible that there will be some changes to the schema for the exported data.json and data.min.json file, I think it would be nice to add schema_version key on the exported .json.

The idea is to let the website know which parser to use based on the schema_version value since the website can get old benchmark data.

You can maybe use x.y version format where x is major changes and y is minor changes, so it will be like 1.0, 1.1, 1.2, 2.0, 2.1, etc.

e.g.

{
    "schema_version": "1.0",
    "metrics": [...],
    "frameworks": [...]
}
waghanza commented 3 years ago

Sure, it will be a great addition. For example, I can 1.0 now and 1.1 when I add hardware section.

However, I think it could lead to ass mess -> having 42 parsers version

We have to edict a good policy about parsing, imho

SuspiciousLookingOwl commented 3 years ago

Since we only bump the version if we actually made some changes to the schema, I don't think we will end up with having too many version.

Plus not all changes are breaking changes, for example adding hardware section wont be a breaking changes since it just adds new field to the json, not changing any of the keys name.

We can probably bump x for breaking changes, and bump y for non breaking changes, for example:

{
    "schema_version": "1.0",
    "metrics": [...],
    "frameworks": [...]
}
{
    "schema_version": "1.1",
    "metrics": [...],
    "frameworks": [...,],
    "hardware": {...}
}
{
    "schema_version": "2.0",
    "renamed_metrics": [...],
    "frameworks": [...,],
    "hardware": {...}
}

And on the website, I only need to make 2 parser instead of 3

function parserV1() {
   return {
      metrics: [], // array of metrics
      frameworks: [], // array of frameworks
      hardware: {}, // hardware info, but can be null since only available on 1.1+      
   }
}

function parserV2() {
   return {
      renamedMetrics: [], 
      frameworks: [], 
      hardware: {},  
   }
}

And even if we ended up with many major versions, we can just limit the provided parser on the website to last 5 major version, so for example if we are on version 7.2, we only need to provide parser for schema version 7, 6, 5, 4, and 3.

waghanza commented 3 years ago

I had the same idea in mind, just 5 seems a lot.

Not any strong opinion, but 3 could be enough