unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47419: 27.1; slow running of snippet which reorders the file
@ 2021-03-26 19:56 scame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-27  1:55 ` bug#47419: 27.1; Misleading profiler info Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: scame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-26 19:56 UTC (permalink / raw)
  To: 47419

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

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)


[-- Attachment #2: dump.zip --]
[-- Type: application/x-zip-compressed, Size: 10936 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-27  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 19:56 bug#47419: 27.1; slow running of snippet which reorders the file scame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-27  1:55 ` bug#47419: 27.1; Misleading profiler info Stefan Monnier
2021-03-27  4:13   ` scame via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).