unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: scame via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 47419@debbugs.gnu.org
Subject: bug#47419: 27.1; slow running of snippet which reorders the file
Date: Fri, 26 Mar 2021 19:56:53 +0000	[thread overview]
Message-ID: <61UDKwhxkYX18O3D1KM_95yXHL-aAqQ8EFR-k0xhF9q3PGOhe2o2USottxht6UbCzZ_D0eDD7xLB0jI28-04XeW4N2s3iLnil176fW89rC0=@protonmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-03-26 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 19:56 scame via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='61UDKwhxkYX18O3D1KM_95yXHL-aAqQ8EFR-k0xhF9q3PGOhe2o2USottxht6UbCzZ_D0eDD7xLB0jI28-04XeW4N2s3iLnil176fW89rC0=@protonmail.com' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=47419@debbugs.gnu.org \
    --cc=laszlomail@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).