mapbox / mapbox/mapbox-gl-js

Increase style-spec performance by investigating alternatives to jsonlint-lines-primitive

Open
#10,961 0 comments 0 reactions 0 assignees View on GitHub
performance :zap:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

## Motivation

For background, last year I worked on playground.geojson.dev (it's basically a more-homebrew GeoJSON.io) and found a way to optimize `geojsonhint` significantly by parsing using a wrapper around `node-jsonc-parser` (VSCode) vs. `jsonlint-lines-primitives`.

https://github.com/sniok/geojson.dev/blob/6eaadf3de9f923952b0c08d6e4ab9ec7ca8a17d4/playground/src/useParsedGeojson.ts#L24

A lot of the changes I made have been upstreamed to MS, but you'd still need a wrapper to add a `jsonlint-lines-primitives` compatible format.

I'd have to rebenchmark for exact numbers, but I believe this could help in GL JS where we validate the style spec.

## Design Alternatives

This isn't necessary, and would need some QC to make sure we're still delivering the same quality of errors.

## Design

Advantages of this design are `node-jsonc-parser` is relatively small and is used by VSCode which gets lots of usage. `node-jsonc-parser` is also significantly faster than `jsonlint` in my testing.

Potential drawbacks: there could be small changes in the output that we would need to document.

### Mock-Up

Ideally there would be no end user changes and minimal changes on the developer side once the JSON is parsed.

### Concepts

### Implementation

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the referenced playground/src/useParsedGeojson.ts wrapper and the current style-spec validation path in mapbox-gl-js. Rebenchmark node-jsonc-parser against jsonlint-lines-primitives, then compare error output quality; the work is done when the performance benefit and compatibility of the replacement are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.