Deutsch English Français Italiano |
<87v7wgr05f.fsf@doppelsaurus.mobileactivedefense.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat <rweikusat@talktalk.net> Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Thu, 21 Nov 2024 17:01:48 +0000 Lines: 22 Message-ID: <87v7wgr05f.fsf@doppelsaurus.mobileactivedefense.com> References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org> <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk> <uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me> <87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com> <ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me> <vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com> <vhk65t$o5i$1@dont-email.me> <871pz62j0v.fsf@doppelsaurus.mobileactivedefense.com> <86bjy8n1ui.fsf@red.stonehenge.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net Un16VQBAl7MB8ADrUii53gPkVQzwWrZ+FEMsI3EKjjgBCWsKY= Cancel-Lock: sha1:Z3lbJ0LV92mupzE89hlReh3Hxlg= sha1:Kv2vCIYbTpWV4EwWvEtcUqwQ14c= sha256:qiVVpWzghq3GIWbDeqowPQ/JF0p6pXuXbkiXx6ukDbs= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Bytes: 2650 merlyn@stonehenge.com (Randal L. Schwartz) writes: >>>>>> "Rainer" == Rainer Weikusat <rweikusat@talktalk.net> writes: > Rainer> ¹ I used to use a JSON parser written in OO-Perl which made > Rainer> extensive use of regexes for that. I've recently replaced that > Rainer> with a C/XS version which - while slightly larger (617 vs 410 > Rainer> lines of text) - is over a hundred times faster and conceptually > Rainer> simpler at the same time. > > I wonder if that was my famous "JSON parser in a single regex" from > https://www.perlmonks.org/?node_id=995856, or from one of the two CPAN > modules that incorporated it. No. One of my use-cases is an interactive shell running in a web browser using ActionCable messages to relay data between the browser and the shell process on the computer supposed to be accessed in this way. For this, I absolutely do need \u escapes. I also need this to be fast. Eg, one of the nice properties of JSON is that the type of a value can be determined by looking at the first character of it. This cries for an implementation based on an array of pointers to 'value parsing routines' of size 256 and determining the parser routine to use by using the first character as index into this table (which will either yield a pointer to the correct parser routine or NULL for a syntax error).