Commit b95296a
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 b95296a
1 file changed
+13
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
| 540 | + | |
545 | 541 | | |
546 | 542 | | |
547 | 543 | | |
| |||
557 | 553 | | |
558 | 554 | | |
559 | 555 | | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
577 | 559 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
595 | 567 | | |
596 | 568 | | |
597 | | - | |
| 569 | + | |
598 | 570 | | |
599 | 571 | | |
600 | | - | |
| 572 | + | |
601 | 573 | | |
602 | 574 | | |
603 | 575 | | |
| |||
0 commit comments