Commit f651189
authored
* Load the map at the speed the cache made possible (#136)
Three causes, each undoing part of what #134 bought.
**The parse brake was throttling cache hits.** The 250 ms gap exists so
back-to-back region PARSES do not hold the main thread — and it was applied to
every job in the queue, including the ones that read a cached region in about a
millisecond. After the disk cache landed, most reads are cache hits, so the
brake had ended up throttling almost exclusively the fast path. That is why
loading felt no quicker with the cache than without it. The queue now asks
whether a job will actually parse before waiting for anything.
**The client only asked again on the two-second position poll.** `mapFetchTiles`
runs from `mapDraw`, so a viewport needing six requests filled in over twelve
seconds, in visible bands — which is the "it loads chunk by chunk" in the
report. While anything is still pending it asks again in 180 ms.
**Empty chunks were requested forever.** A chunk was marked "known empty" only
when the whole response reported nothing pending, and on a busy viewport
something always is — so a chunk the server had read and found empty was never
marked and came back on every draw. The response now names them: `empty` is "I
read that region and there is nothing there", which is a different fact from
"not read yet", and the client can tell them apart. This is the "sometimes it
never loads".
**And an empty area now says so.** Ungenerated chunks were black, which is
indistinguishable from still-loading and from broken — an operator was waiting
for a load that was never coming. They are drawn as a faint hatch in the site's
own accent colour, with a line saying nobody has been there, once enough of the
view is empty to be worth explaining.
* Self-review: measure the parse instead of predicting it, and stop an infinite poll
I gated the brake behind a `willParse()` that re-stat'd the region file and
checked for a cache file — to guess at work the very next call was about to do
anyway. Two stats per queued job, thousands of jobs. The queue runs the job and
then looks at whether `lastParseAt` moved: no prediction, no extra filesystem
work, and the brake applies exactly when a parse happened rather than when one
was expected.
Worse, and mine from this PR: asking again every 180 ms while anything is
pending turns an unreadable region into a permanent polling loop. `loadRegion`
returned null on a read failure, `peekChunkTile` therefore answered "not read
yet" forever, and the client would have asked for that chunk every 180 ms for as
long as the page stayed open. A region that cannot be read is remembered as
EMPTY — which is honest, there is nothing to draw — and terminates.
Also dropped a `pending` counter I computed in the ungenerated-area note and
never used.
1 parent 2223a75 commit f651189
4 files changed
Lines changed: 110 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
539 | 554 | | |
540 | 555 | | |
541 | 556 | | |
542 | 557 | | |
543 | | - | |
| 558 | + | |
544 | 559 | | |
545 | | - | |
| 560 | + | |
546 | 561 | | |
547 | 562 | | |
548 | 563 | | |
| |||
629 | 644 | | |
630 | 645 | | |
631 | 646 | | |
632 | | - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
633 | 653 | | |
| 654 | + | |
634 | 655 | | |
635 | 656 | | |
636 | 657 | | |
637 | 658 | | |
| 659 | + | |
638 | 660 | | |
639 | 661 | | |
640 | 662 | | |
| |||
652 | 674 | | |
653 | 675 | | |
654 | 676 | | |
655 | | - | |
| 677 | + | |
656 | 678 | | |
657 | 679 | | |
658 | 680 | | |
659 | 681 | | |
660 | 682 | | |
661 | 683 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | 684 | | |
669 | 685 | | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
670 | 694 | | |
671 | 695 | | |
672 | 696 | | |
673 | 697 | | |
674 | 698 | | |
675 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
676 | 706 | | |
677 | 707 | | |
678 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
285 | 289 | | |
286 | | - | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
289 | 296 | | |
290 | 297 | | |
291 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
354 | 356 | | |
355 | 357 | | |
356 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
327 | 335 | | |
328 | 336 | | |
329 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
330 | 345 | | |
331 | 346 | | |
332 | 347 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | 348 | | |
337 | | - | |
338 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
339 | 356 | | |
340 | 357 | | |
341 | 358 | | |
| |||
401 | 418 | | |
402 | 419 | | |
403 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
404 | 457 | | |
405 | 458 | | |
406 | 459 | | |
| |||
471 | 524 | | |
472 | 525 | | |
473 | 526 | | |
| 527 | + | |
474 | 528 | | |
475 | 529 | | |
476 | 530 | | |
| |||
0 commit comments