From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jackson Ray Hamilton Newsgroups: gmane.emacs.devel Subject: Emacs crashes when writting JavaScript Date: Sun, 22 Sep 2019 17:50:29 -0700 Message-ID: <4d136a64-b3f4-24e4-1f28-c22a59468295@jacksonrayhamilton.com> References: <87v9tqcd57.fsf@yahoo.com.mx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------F9CC7134F7C599394AFEDDEA" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="102183"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: emacs-devel@gnu.org To: jorgejavieran@yahoo.com.mx Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 23 02:50:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iCCZ2-000QTF-D7 for ged-emacs-devel@m.gmane.org; Mon, 23 Sep 2019 02:50:53 +0200 Original-Received: from localhost ([::1]:51508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCCZ1-0007WZ-97 for ged-emacs-devel@m.gmane.org; Sun, 22 Sep 2019 20:50:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCCYl-0007WT-9M for emacs-devel@gnu.org; Sun, 22 Sep 2019 20:50:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCCYj-00069y-J3 for emacs-devel@gnu.org; Sun, 22 Sep 2019 20:50:34 -0400 Original-Received: from mta-08-4.privateemail.com ([198.54.122.58]:1053) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCCYj-00069F-9j for emacs-devel@gnu.org; Sun, 22 Sep 2019 20:50:33 -0400 Original-Received: from MTA-08.privateemail.com (localhost [127.0.0.1]) by MTA-08.privateemail.com (Postfix) with ESMTP id 2C92D6003E; Sun, 22 Sep 2019 20:50:30 -0400 (EDT) Original-Received: from [192.168.1.14] (unknown [10.20.151.241]) by MTA-08.privateemail.com (Postfix) with ESMTPA id E8B2C60033; Mon, 23 Sep 2019 00:50:29 +0000 (UTC) In-Reply-To: <87v9tqcd57.fsf@yahoo.com.mx> Content-Language: en-US X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 198.54.122.58 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240254 Archived-At: This is a multi-part message in MIME format. --------------F9CC7134F7C599394AFEDDEA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hola Jorge, Emacs=E2=80=99 JSX support is relatively new and could probably be optimi= zed to=20 perform better at scale.=C2=A0 I noticed similar slowdowns with files=20 containing 300+ lines of JSX. Before I contributed the JSX support code to Emacs, I used=20 (elp-instrument-package "js-") and (elp-results) to identify choke=20 points during editing.=C2=A0 I felt like I was able to slightly improve=20 performance for large files, going from =E2=80=9Cunusable=E2=80=9D to mer= ely =E2=80=9Cfrustrating.=E2=80=9D If you are familiar with Emacs Lisp and feel compelled to make things=20 stabler and faster, perhaps you can find some time to benchmark and=20 experiment in lisp/progmodes/js.el.=C2=A0 Otherwise, please open a bug re= port. Some tips if you decide to help: you mentioned an AST, but there isn=E2=80= =99t=20 one.=C2=A0 Parsing starts in js-syntax-propertize.=C2=A0 Years ago, Sebas= tian=20 Wiesner wrote some blog articles explaining how syntax highlighting=20 worked in Emacs, but he=E2=80=99s since removed those posts from his blog= and=20 they aren=E2=80=99t available on Internet Archive. Maybe he will provide = you=20 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.=C2=A0 = That=20 will make it easier for tools like Emacs, prettifiers, and linters to=20 process your code.=C2=A0 Even though the code can probably be optimized,=20 since we care about accuracy parsing time will ultimately be gated by=20 file length regardless. Smaller modules are also consistent with some=20 programmers=E2=80=99 expectations for high quality code; they are more li= kely to=20 be below length thresholds permitting easy comprehension. Jackson --------------F9CC7134F7C599394AFEDDEA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Hola Jorge,

Emacs=E2=80=99 JSX support is relatively new and could probably be optimized to perform better at scale.=C2=A0 I noticed similar slowd= owns 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.=C2=A0 I felt like I was able to slightly imp= rove performance for large files, going from =E2=80=9Cunusable=E2=80=9D = to merely =E2=80=9Cfrustrating.=E2=80=9D

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.=C2=A0 Otherwise, please open a bug report.

Some tips if you decide to help: you mentioned an AST, but there isn=E2=80=99t one.=C2=A0 Parsing starts in js-syntax-propertize.=C2= =A0 Years ago, Sebastian Wiesner wrote some blog articles explaining how syntax highlighting worked in Emacs, but he=E2=80=99s since removed those = posts from his blog and they aren=E2=80=99t available on Internet Archive= .=C2=A0 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.=C2=A0 That will make it easier for tools like Emacs, prettifiers, and linters to process your code.=C2=A0 Even though th= e code can probably be optimized, since we care about accuracy parsing time will ultimately be gated by file length regardless.=C2= =A0 Smaller modules are also consistent with some programmers=E2=80=99 expectations for high quality code; they are more likely to be below length thresholds permitting easy comprehension.

Jackson

--------------F9CC7134F7C599394AFEDDEA--