unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* web-mode.el and speed
@ 2013-10-07 19:29 Bois Francois-Xavier
  2013-10-07 20:05 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Bois Francois-Xavier @ 2013-10-07 19:29 UTC (permalink / raw)
  To: emacs-devel

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

Dear Emacsians,

I am the author of web-mode.el (http://web-mode.org) a major mode for
editing web templates (html files with js/css parts, and server blocks).

The performance of this mode is good, but I would like, as a challenge, to
speed up the loading of really huge HTML documents (my test file is
http://www.w3.org/html/wg/drafts/html/master/single-page.html)

I think that using a search-chars-forward (native) function could improve
the performance
(search-chars-foward '(?\< ?\>))

Do you think that such a function could be useful for other modes ? Does a
core developer could implement it ?


Fx

[-- Attachment #2: Type: text/html, Size: 936 bytes --]

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

* Re: web-mode.el and speed
  2013-10-07 19:29 web-mode.el and speed Bois Francois-Xavier
@ 2013-10-07 20:05 ` Eli Zaretskii
  2013-10-07 20:21   ` Bois Francois-Xavier
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2013-10-07 20:05 UTC (permalink / raw)
  To: Bois Francois-Xavier; +Cc: emacs-devel

> From: Bois Francois-Xavier <fxbois@gmail.com>
> Date: Mon, 7 Oct 2013 21:29:42 +0200
> 
> I think that using a search-chars-forward (native) function could improve
> the performance
> (search-chars-foward '(?\< ?\>))

What's wrong with skip-chars-forward?



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

* Re: web-mode.el and speed
  2013-10-07 20:05 ` Eli Zaretskii
@ 2013-10-07 20:21   ` Bois Francois-Xavier
  2013-10-07 20:56     ` Andreas Schwab
                       ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bois Francois-Xavier @ 2013-10-07 20:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

I think that a function that would not rely on regexp could improve
drastically the performance.
For seconds are needed to load the html5-spec page. And most of the time is
spent identifying tags. So any micro optimization can have a huge impact.

(I have previously won 20% in perfomance when I modified the tag attributes
parser function to use chars instead of strings. I would have never thought
that the gain would be so large)


On Mon, Oct 7, 2013 at 10:05 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Bois Francois-Xavier <fxbois@gmail.com>
> > Date: Mon, 7 Oct 2013 21:29:42 +0200
> >
> > I think that using a search-chars-forward (native) function could improve
> > the performance
> > (search-chars-foward '(?\< ?\>))
>
> What's wrong with skip-chars-forward?
>

[-- Attachment #2: Type: text/html, Size: 1292 bytes --]

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

* Re: web-mode.el and speed
  2013-10-07 20:21   ` Bois Francois-Xavier
@ 2013-10-07 20:56     ` Andreas Schwab
  2013-10-07 22:54     ` Stefan Monnier
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2013-10-07 20:56 UTC (permalink / raw)
  To: Bois Francois-Xavier; +Cc: Eli Zaretskii, emacs-devel

Bois Francois-Xavier <fxbois@gmail.com> writes:

> I think that a function that would not rely on regexp could improve
> drastically the performance.

skip-chars-forward doesn't use a regexp.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

* Re: web-mode.el and speed
  2013-10-07 20:21   ` Bois Francois-Xavier
  2013-10-07 20:56     ` Andreas Schwab
@ 2013-10-07 22:54     ` Stefan Monnier
  2013-10-08  6:21     ` Eli Zaretskii
  2013-10-09 11:04     ` Andreas Röhler
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-10-07 22:54 UTC (permalink / raw)
  To: Bois Francois-Xavier; +Cc: Eli Zaretskii, emacs-devel

> I think that a function that would not rely on regexp could improve
> drastically the performance.

Did you profile the code?


        Stefan "it doesn't use a regexp, but (re-search-forward "[<>]"),
                which does, should be about as fast anyway."



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

* Re: web-mode.el and speed
  2013-10-07 20:21   ` Bois Francois-Xavier
  2013-10-07 20:56     ` Andreas Schwab
  2013-10-07 22:54     ` Stefan Monnier
@ 2013-10-08  6:21     ` Eli Zaretskii
  2013-10-09 11:04     ` Andreas Röhler
  3 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2013-10-08  6:21 UTC (permalink / raw)
  To: Bois Francois-Xavier; +Cc: emacs-devel

> From: Bois Francois-Xavier <fxbois@gmail.com>
> Date: Mon, 7 Oct 2013 22:21:30 +0200
> Cc: emacs-devel@gnu.org
> 
> I think that a function that would not rely on regexp could improve
> drastically the performance.
> For seconds are needed to load the html5-spec page. And most of the time is
> spent identifying tags. So any micro optimization can have a huge impact.
> 
> (I have previously won 20% in perfomance when I modified the tag attributes
> parser function to use chars instead of strings. I would have never thought
> that the gain would be so large)

As others have pointed out, you are trying to optimize without making
any measurements.  This methodology is known to lead to wrong
conclusions.  So you are well advised to try skip-chars-forward and
see if it is fast enough for your use case.



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

* Re: web-mode.el and speed
  2013-10-07 20:21   ` Bois Francois-Xavier
                       ` (2 preceding siblings ...)
  2013-10-08  6:21     ` Eli Zaretskii
@ 2013-10-09 11:04     ` Andreas Röhler
  3 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2013-10-09 11:04 UTC (permalink / raw)
  To: emacs-devel

Am 07.10.2013 22:21, schrieb Bois Francois-Xavier:
> I think that a function that would not rely on regexp could improve
> drastically the performance.
> For seconds are needed to load the html5-spec page. And most of the time is
> spent identifying tags. So any micro optimization can have a huge impact.
>
> (I have previously won 20% in perfomance when I modified the tag attributes
> parser function to use chars instead of strings. I would have never thought
> that the gain would be so large)
>
>
> On Mon, Oct 7, 2013 at 10:05 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>>> From: Bois Francois-Xavier <fxbois@gmail.com>
>>> Date: Mon, 7 Oct 2013 21:29:42 +0200
>>>
>>> I think that using a search-chars-forward (native) function could improve
>>> the performance
>>> (search-chars-foward '(?\< ?\>))
>>
>> What's wrong with skip-chars-forward?
>>
>

As it was said: skip-chars-forward

there is still the string/comment issue, where it probably shouldn't match

(while (and (< 0 (abs (skip-chars-forward CHARS)))(nth 8 (syntax-ppss))))



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

end of thread, other threads:[~2013-10-09 11:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-07 19:29 web-mode.el and speed Bois Francois-Xavier
2013-10-07 20:05 ` Eli Zaretskii
2013-10-07 20:21   ` Bois Francois-Xavier
2013-10-07 20:56     ` Andreas Schwab
2013-10-07 22:54     ` Stefan Monnier
2013-10-08  6:21     ` Eli Zaretskii
2013-10-09 11:04     ` Andreas Röhler

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