all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: How should this profiler report interpreted?
@ 2021-03-26 19:48 scame via Users list for the GNU Emacs text editor
  2021-03-26 20:26 ` Joost Kremers
  0 siblings, 1 reply; 18+ messages in thread
From: scame via Users list for the GNU Emacs text editor @ 2021-03-26 19:48 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> If you can reproduce this bogus profile, please `M-x report-emacs-bug`
> (ideally with a corresponding sample file on which to run the code).

I'll do that.

The computer was not unresponsive, only emacs was slow and emacs profiler said 99% CPU.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: How should this profiler report interpreted?
@ 2021-03-26 21:57 scame via Users list for the GNU Emacs text editor
  2021-03-26 22:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 18+ messages in thread
From: scame via Users list for the GNU Emacs text editor @ 2021-03-26 21:57 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> >

If you can reproduce this bogus profile, please `M-x report-emacs-bug`

> >

(ideally with a corresponding sample file on which to run the code).

>
> I'll do that.

It's here with a sample file. I'm curious what you make of it:

https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-03/msg02017.html

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: How should this profiler report interpreted?
@ 2021-03-26 15:28 scame via Users list for the GNU Emacs text editor
  2021-03-26 15:49 ` Eli Zaretskii
  2021-03-26 17:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 18+ messages in thread
From: scame via Users list for the GNU Emacs text editor @ 2021-03-26 15:28 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> > Does this mean the save-excursion call itself consumes 99% of the CPU?
> Yes (assuming that nothing else went on in that Emacs session when you
> profiled the function you were interested in).

Nothing else which consumes significant CPU, just the tested function.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: How should this profiler report interpreted?
@ 2021-03-26 15:24 scame
  2021-03-26 17:58 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-03-26 18:38 ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: scame @ 2021-03-26 15:24 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> 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?




^ permalink raw reply	[flat|nested] 18+ messages in thread
* How should this profiler report interpreted?
@ 2021-03-26 13:59 scame
  2021-03-26 14:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-03-26 14:35 ` Eli Zaretskii
  0 siblings, 2 replies; 18+ messages in thread
From: scame @ 2021-03-26 13:59 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I have a function which I use to process some files and it works
slowly with bigger files. I tried to profile it and I got this output.
Only the relevant part is shown:

 - save-excursion                                     9817  99%
  - insert                                               2   0%
   - jit-lock-after-change                               1   0%
    - run-hook-with-args                                 1   0%
       font-lock-extend-jit-lock-region-after-change     1   0%

Does this mean the save-excursion call itself consumes 99% of the CPU?



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

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

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-26 19:48 How should this profiler report interpreted? scame via Users list for the GNU Emacs text editor
2021-03-26 20:26 ` Joost Kremers
  -- strict thread matches above, loose matches on Subject: below --
2021-03-26 21:57 scame via Users list for the GNU Emacs text editor
2021-03-26 22:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 15:28 scame via Users list for the GNU Emacs text editor
2021-03-26 15:49 ` Eli Zaretskii
2021-03-26 17:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 15:24 scame
2021-03-26 17:58 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 18:38 ` Stefan Monnier
2021-03-26 18:48   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 19:41     ` Stefan Monnier
2021-03-26 21:45       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-27 16:22         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-27 16:30           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 13:59 scame
2021-03-26 14:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 14:35 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.