ARK-Builders / ark-core

The core of the ARK framework
MIT License
4 stars 3 forks source link

Update `FileStorage` write to disk format to valid JSON #41

Closed tareknaser closed 4 months ago

tareknaser commented 5 months ago

Description

This pull request addresses the issue where the write to disk format for FileStorage was not valid JSON:

Changes

Previously, the format looked like this:

version 2
{"a":"1","b":"2"}

After this pull request, the format will be updated to the following valid JSON format:

{
  "version": 3,
  "data": {
    "a": "1",
    "b": "2",
    "c": "3"
  }
}

In addition to fixing the format, this pull request also bumps the version to 3 (JSON).

Furthermore, support for reading the legacy version 2 plaintext FileStorage format is added for backwards compatibility. This is achieved through the addition of a helper function read_version_2_fs, along with a unit test.

github-actions[bot] commented 5 months ago

Benchmark for 9ff67f5

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | ../test-assets/lena.jpg/compute_bytes | 13.1±0.24µs | 13.1±0.27µs | 0.00% | | ../test-assets/test.pdf/compute_bytes | **188.4±2.72µs** | 197.8±1.90µs | **+4.99%** | | compute_bytes_large/compute_bytes | **281.6±3.78µs** | 312.5±3.78µs | **+10.97%** | | compute_bytes_medium/compute_bytes | 26.2±0.61µs | 26.3±0.75µs | +0.38% | | compute_bytes_small/compute_bytes | 126.4±3.03ns | 127.9±3.04ns | +1.19% | | index_build/index_build/../test-assets/ | 153.9±2.61µs | 154.3±8.53µs | +0.26% |
github-actions[bot] commented 5 months ago

Benchmark for 64e949a

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | ../test-assets/lena.jpg/compute_bytes | 13.3±0.05µs | 13.3±0.14µs | 0.00% | | ../test-assets/test.pdf/compute_bytes | 110.1±0.46µs | 110.2±0.80µs | +0.09% | | compute_bytes_large/compute_bytes | 136.9±1.20µs | 136.4±1.72µs | -0.37% | | compute_bytes_medium/compute_bytes | **27.1±0.71µs** | 28.2±0.34µs | **+4.06%** | | compute_bytes_small/compute_bytes | 129.8±2.54ns | 130.2±1.15ns | +0.31% | | index_build/index_build/../test-assets/ | 157.4±0.60µs | 157.3±0.72µs | -0.06% |