a-b-street / osm2lanes

A common library and set of test cases for transforming OSM tags to lane specifications
https://a-b-street.github.io/osm2lanes/
Apache License 2.0
34 stars 2 forks source link

Add a button to generate example test YAML from the web app #256

Closed dabreegster closed 2 years ago

dabreegster commented 2 years ago

If you want to add a test case to the .yaml today, you have to:

This PR mostly fixes the first. You can use the web app, get the current output, and generate the YAML. You have to manually fix it up -- usually because the expected output is wrong -- but this is much faster workflow. Screenshot from 2022-11-01 11-58-35

github-actions[bot] commented 2 years ago

Benchmark for 9e4a596

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | tests/224637155 | 6.6±0.30µs | 6.7±0.27µs | +1.52% | | tests/380103730 Japanese Expressway | 8.8±0.53µs | 8.7±0.37µs | -1.14% | | tests/389654080 | 10.6±0.41µs | 10.8±0.36µs | +1.89% | | tests/49207928 cycleway:BACKWARD=lane | 7.9±0.23µs | 8.0±0.21µs | +1.27% | | tests/8591383 a bidirectional cycleway, oneway:bicycle | **9.1±0.38µs** | 10.0±0.41µs | **+9.89%** | | tests/bus:lanes=designated\| | 8.2±0.25µs | 8.3±0.21µs | +1.22% | | tests/busway=lane | **7.3±0.17µs** | 7.6±0.33µs | **+4.11%** | | tests/cycleway=lane | 7.5±0.25µs | 7.7±0.32µs | +2.67% | | tests/cycleway=opposite oneway=yes oneway:bicycle=no | 7.2±0.26µs | 7.3±0.29µs | +1.39% | | tests/cycleway=opposite_track oneway=yes, deprecated | 8.4±0.36µs | 8.5±0.31µs | +1.19% | | tests/sidewalk:right=yes | 6.7±0.32µs | 6.8±0.28µs | +1.49% | | tests/sidewalk=both | 7.0±0.49µs | 7.0±0.29µs | 0.00% |
github-actions[bot] commented 2 years ago

Benchmark for 34bc72f

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | tests/224637155 | 5.4±0.00µs | 5.4±0.01µs | 0.00% | | tests/380103730 Japanese Expressway | 7.3±0.09µs | **7.1±0.02µs** | **-2.74%** | | tests/389654080 | 8.8±0.01µs | **8.6±0.01µs** | **-2.27%** | | tests/49207928 cycleway:BACKWARD=lane | 6.6±0.01µs | 6.6±0.00µs | 0.00% | | tests/8591383 a bidirectional cycleway, oneway:bicycle | 7.4±0.01µs | **7.2±0.01µs** | **-2.70%** | | tests/bus:lanes=designated\| | 6.7±0.01µs | **6.6±0.03µs** | **-1.49%** | | tests/busway=lane | 6.1±0.12µs | **6.0±0.03µs** | **-1.64%** | | tests/cycleway=lane | 6.3±0.01µs | **6.1±0.00µs** | **-3.17%** | | tests/cycleway=opposite oneway=yes oneway:bicycle=no | 5.9±0.01µs | **5.8±0.01µs** | **-1.69%** | | tests/cycleway=opposite_track oneway=yes, deprecated | 6.9±0.01µs | **6.8±0.01µs** | **-1.45%** | | tests/sidewalk:right=yes | 5.5±0.01µs | **5.4±0.01µs** | **-1.82%** | | tests/sidewalk=both | 5.8±0.11µs | **5.7±0.01µs** | **-1.72%** |
github-actions[bot] commented 2 years ago

Benchmark for a22fedc

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | tests/224637155 | 7.1±0.37µs | 7.3±0.44µs | +2.82% | | tests/380103730 Japanese Expressway | 10.2±0.82µs | 9.5±0.70µs | -6.86% | | tests/389654080 | 11.9±0.60µs | 12.1±0.84µs | +1.68% | | tests/49207928 cycleway:BACKWARD=lane | 8.9±0.46µs | 8.7±0.50µs | -2.25% | | tests/8591383 a bidirectional cycleway, oneway:bicycle | 10.0±0.60µs | 9.8±0.79µs | -2.00% | | tests/bus:lanes=designated\| | 9.1±0.58µs | 9.3±1.21µs | +2.20% | | tests/busway=lane | 8.0±0.52µs | 8.4±0.72µs | +5.00% | | tests/cycleway=lane | 8.5±0.62µs | 8.5±0.68µs | 0.00% | | tests/cycleway=opposite oneway=yes oneway:bicycle=no | 8.3±0.74µs | 8.2±0.95µs | -1.20% | | tests/cycleway=opposite_track oneway=yes, deprecated | 9.2±0.57µs | 9.5±0.91µs | +3.26% | | tests/sidewalk:right=yes | 7.6±0.39µs | 7.7±0.60µs | +1.32% | | tests/sidewalk=both | 8.2±0.57µs | **7.6±0.38µs** | **-7.32%** |
dabreegster commented 2 years ago

I was going to add a "copy to clipboard" button for convenience, but it's unexpectedly tough in Yew.

Option 1: just have an onclick="someJSFunction()". I can't get this to work; The yew HTML macro insists on callbacks being in Rust, and the docs don't talk about any escape hatch to just call JS. I could define the function in JS and make a WASM interface to it, I guess. https://yew.rs/docs/0.18.0/concepts/html/elements#listeners

Option 2: Copy to the clipboard via rust. But the necessary APIs are unstable. https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html

So for now, this tool is helpful and I'll merge. Will still add more options to filter out separators / widths later.

github-actions[bot] commented 2 years ago

Benchmark for 0d080d8

Click to view benchmark | Test | Base | PR | % | |------|--------------|------------------|---| | tests/224637155 | 5.8±0.33µs | 5.9±0.78µs | +1.72% | | tests/380103730 Japanese Expressway | 7.8±0.38µs | 7.6±0.41µs | -2.56% | | tests/389654080 | 9.6±0.71µs | 9.5±0.62µs | -1.04% | | tests/49207928 cycleway:BACKWARD=lane | 7.3±0.62µs | 7.1±0.32µs | -2.74% | | tests/8591383 a bidirectional cycleway, oneway:bicycle | 7.9±0.42µs | 8.0±0.79µs | +1.27% | | tests/bus:lanes=designated\| | 7.4±0.43µs | 7.3±0.40µs | -1.35% | | tests/busway=lane | 6.5±0.47µs | 6.5±0.34µs | 0.00% | | tests/cycleway=lane | 6.8±0.31µs | 6.9±0.59µs | +1.47% | | tests/cycleway=opposite oneway=yes oneway:bicycle=no | 6.4±0.49µs | 6.3±0.33µs | -1.56% | | tests/cycleway=opposite_track oneway=yes, deprecated | 7.4±0.39µs | 7.4±0.56µs | 0.00% | | tests/sidewalk:right=yes | 5.9±0.25µs | 5.9±0.30µs | 0.00% | | tests/sidewalk=both | 6.1±0.24µs | 6.1±0.30µs | 0.00% |