From: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
To: jorgejavieran@yahoo.com.mx
Cc: emacs-devel@gnu.org
Subject: Emacs crashes when writting JavaScript
Date: Sun, 22 Sep 2019 17:50:29 -0700 [thread overview]
Message-ID: <4d136a64-b3f4-24e4-1f28-c22a59468295@jacksonrayhamilton.com> (raw)
In-Reply-To: <87v9tqcd57.fsf@yahoo.com.mx>
[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]
Hola Jorge,
Emacs’ JSX support is relatively new and could probably be optimized to
perform better at scale. I noticed similar slowdowns with files
containing 300+ lines of JSX.
Before I contributed the JSX support code to Emacs, I used
(elp-instrument-package "js-") and (elp-results) to identify choke
points during editing. I felt like I was able to slightly improve
performance for large files, going from “unusable” to merely “frustrating.”
If you are familiar with Emacs Lisp and feel compelled to make things
stabler and faster, perhaps you can find some time to benchmark and
experiment in lisp/progmodes/js.el. Otherwise, please open a bug report.
Some tips if you decide to help: you mentioned an AST, but there isn’t
one. Parsing starts in js-syntax-propertize. Years ago, Sebastian
Wiesner wrote some blog articles explaining how syntax highlighting
worked in Emacs, but he’s since removed those posts from his blog and
they aren’t available on Internet Archive. Maybe he will provide you
with the articles if you ask him for:
* 2014, Mar 11 Overview of Emacs Font Locking
* 2014, Mar 12 Syntactic fontification in Emacs
* 2014, Mar 26 Search-based fontification with keywords
* 2014, Jun 16 Advanced syntactic fontification
Also, maybe you could separate your JSX code into smaller modules. That
will make it easier for tools like Emacs, prettifiers, and linters to
process your code. Even though the code can probably be optimized,
since we care about accuracy parsing time will ultimately be gated by
file length regardless. Smaller modules are also consistent with some
programmers’ expectations for high quality code; they are more likely to
be below length thresholds permitting easy comprehension.
Jackson
[-- Attachment #2: Type: text/html, Size: 2270 bytes --]
next prev parent reply other threads:[~2019-09-23 0:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87v9tqcd57.fsf.ref@yahoo.com.mx>
2019-09-18 6:49 ` Emacs crashes when writting JavaScript Jorge Javier Araya Navarro
2019-09-18 12:18 ` Eli Zaretskii
2019-09-23 0:50 ` Jackson Ray Hamilton [this message]
2019-09-23 13:29 ` Dmitry Gutov
2019-09-23 18:12 ` [SPAM UNSURE] " Stephen Leake
2019-09-23 18:30 ` Jorge Javier Araya Navarro
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d136a64-b3f4-24e4-1f28-c22a59468295@jacksonrayhamilton.com \
--to=jackson@jacksonrayhamilton.com \
--cc=emacs-devel@gnu.org \
--cc=jorgejavieran@yahoo.com.mx \
/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 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.