Commit a4e246e
committed
Optimize and simplify
The function has implemented a poor man's hash table by manually
enlisting keys and then using `cl-case` on values. Just replace this
with a hashtable and thus simplify the code considerably. This makes
it faster as well because the `cl-case + setq` is O(n) whereas
`puthash` is O(1).
The output of the function was tested on Pandoc's
`Writers/Powerpoint/Output.hs` file of 2841 lines and comparing the
hashsum of the output before the changes and after. It didn't change.
The commit is also basically a backport of a similar change on
purescript-mode that has been forked form haskell-mode at some point:
purescript-emacs/purescript-mode#27haskell-ds-create-imenu-index with hashtable1 parent 7d4529a commit a4e246e
1 file changed
Lines changed: 14 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
| 541 | + | |
545 | 542 | | |
546 | 543 | | |
547 | 544 | | |
| |||
557 | 554 | | |
558 | 555 | | |
559 | 556 | | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
577 | 560 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
595 | 568 | | |
596 | 569 | | |
597 | | - | |
| 570 | + | |
598 | 571 | | |
599 | 572 | | |
600 | | - | |
| 573 | + | |
601 | 574 | | |
602 | 575 | | |
603 | 576 | | |
| |||
0 commit comments