help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How should this profiler report interpreted?


From: scame
Subject: Re: How should this profiler report interpreted?
Date: Fri, 26 Mar 2021 15:24:14 +0000

> To me it looks like it means the tool isn't up for the job :)
> Interesting question BTW! How did you do it, exactly?

I process a generated file where certain lines are connected
by an id. I extract the id from a line, then search backwards
for the matching line using the extracted id and there I insert
the line after the matching line in the file.


  ...
  (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)))
      )))

This is the save-excursion which takes 99% CPU and very slow.

I probably could change up the code bit, so the problem does not appear,
but I'm curious what the problem is here. Is it a bug?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]