[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47419: 27.1; slow running of snippet which reorders the file
From: |
scame |
Subject: |
bug#47419: 27.1; slow running of snippet which reorders the file |
Date: |
Fri, 26 Mar 2021 19:56:53 +0000 |
As discussed on emacs-helpĀ I'm posting this example here which
reorders the file and runs slowly.
Though it's an sql dump file with long lines, the file is navigable without
any problem or slowness. Only this snippet runs slowly.
Here's the snippet:
(progn
(goto-char (point-min))
(when (search-forward "INSERT INTO `test2` (`aa`, `bb`) VALUES" nil t)
(beginning-of-line)
(while (looking-at "INSERT INTO `test2`.+,\\([0-9]+\\));")
(let ((item (match-string 1))
(line (buffer-substring (line-beginning-position)
(line-end-position))))
(message item)
(save-excursion
(re-search-backward (concat "INSERT INTO `test1`.+"
"VALUES ("
item
","))
(end-of-line)
(insert "\n" line))
(delete-region (line-beginning-position) (1+ (line-end-position)))
))))
And the example file to run it on is attached. (anonymized sql dump)
dump.zip
Description: Zip compressed data
- bug#47419: 27.1; slow running of snippet which reorders the file,
scame <=