Commit 0e3f513
committed
Provide faster setStyle implementation
This work sponsored by [Integrated Transport
Planning](https://www.itpworld.net) and the World Bank.
Performance still wasn't good enough when styling 20000 features at
once. Turns out it's something to do with how shiny sends different data
types between R and JS.
Shiny passes arrays much faster than objects. I don't know if the delay
is in encoding or transmission. You can then reassemble the required
objects in JS basically for free.
The same optimisation will probably be possible for addPolylines, etc.
At the moment shiny sends an array of arrays of arrays of objects of
arrays. Which is unnecessarily convoluted and requires the creation of
N small objects and at least 4N small arrays.
I suspect that it will be faster to send a smaller number of larger
arrays -- something like the format provided by st_coordinates -- or
possibly to use a space efficient encoding scheme like Google's encoded
polyline (plugin available for leaflet).1 parent dd98440 commit 0e3f513
File tree
5 files changed
+37
-8
lines changed- R
- inst/htmlwidgets
- javascript/src
- man
5 files changed
+37
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1285 | 1285 | | |
1286 | 1286 | | |
1287 | 1287 | | |
| 1288 | + | |
| 1289 | + | |
1288 | 1290 | | |
1289 | 1291 | | |
1290 | 1292 | | |
1291 | 1293 | | |
1292 | 1294 | | |
1293 | | - | |
| 1295 | + | |
1294 | 1296 | | |
1295 | 1297 | | |
1296 | 1298 | | |
1297 | 1299 | | |
1298 | | - | |
| 1300 | + | |
1299 | 1301 | | |
1300 | 1302 | | |
1301 | 1303 | | |
1302 | 1304 | | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1303 | 1316 | | |
1304 | 1317 | | |
1305 | 1318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
33 | 44 | | |
34 | 45 | | |
35 | 46 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments