Commit 0a3805e
perf(show modules): eliminate BSON decode for type-based counting
show modules was decoding ALL page, microflow, nanoflow, snippet,
enumeration, constant and Java action documents (via listPagesWithContainerGen,
listMicroflowsWithContainerGen, etc.) just to produce count columns.
The unitCache already carries type strings from the BSON $Type field —
no document decoding is needed for counting.
Replace the multi-function approach with a single pass over ListUnits()
using a switch on types.UnitTypeXxx constants. Entity counts still require
domain-model decoding (entities are sub-objects, not standalone units).
Also add mdl/types/unit_types.go with exported BSON type name constants
(types.UnitTypePage, types.UnitTypeMicroflow, etc.) shared across executor
and backend layers, replacing scattered hard-coded string literals.
Expected speedup: eliminates ~9 domain-model decodes + all page/microflow/
snippet/nanoflow/enumeration/constant decodes per show modules invocation.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 5985101 commit 0a3805e
2 files changed
Lines changed: 78 additions & 66 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
450 | 452 | | |
451 | 453 | | |
452 | | - | |
453 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
454 | 470 | | |
455 | | - | |
| 471 | + | |
456 | 472 | | |
457 | | - | |
| 473 | + | |
458 | 474 | | |
459 | | - | |
460 | | - | |
461 | | - | |
| 475 | + | |
462 | 476 | | |
463 | | - | |
| 477 | + | |
464 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
465 | 483 | | |
466 | 484 | | |
467 | 485 | | |
468 | | - | |
| 486 | + | |
| 487 | + | |
469 | 488 | | |
470 | 489 | | |
471 | 490 | | |
| |||
476 | 495 | | |
477 | 496 | | |
478 | 497 | | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | 498 | | |
536 | 499 | | |
537 | 500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments