From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Herman=2C_G=C3=A9za?= Newsgroups: gmane.emacs.devel Subject: Re: I created a faster JSON parser Date: Tue, 19 Mar 2024 20:05:23 +0100 Message-ID: <878r2erq4u.fsf@gmail.com> References: <87a5n96mb5.fsf@gmail.com> <20240309203725.x456m7c6soxtgj6q@nullprogram.com> <86jzmawqbm.fsf@gnu.org> <87ttldydf2.fsf@posteo.net> <867ci8vqvl.fsf@gnu.org> <5396AC95-1D8F-4A89-B4A8-647B717A1E3C@gmail.com> <87r0ggdcki.fsf@gmail.com> <437D901F-CEC6-45E0-8ABE-B036A7B0AAF5@gmail.com> <87cyrv8vka.fsf@gmail.com> <05E839F0-736C-42C0-8344-1C8945E90289@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16816"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Herman=2C_G=C3=A9za?= , Gerd =?utf-8?Q?M=C3=B6llmann?= , Eli Zaretskii , Philip Kaludercic , wellons@nullprogram.com, emacs-devel@gnu.org To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 19 20:14:35 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rmeuw-0004E6-44 for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Mar 2024 20:14:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmeuR-0003nY-Mk; Tue, 19 Mar 2024 15:14:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmeuQ-0003n7-5L for emacs-devel@gnu.org; Tue, 19 Mar 2024 15:14:02 -0400 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmeuL-0003mf-G5; Tue, 19 Mar 2024 15:14:01 -0400 Original-Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so283972a12.1; Tue, 19 Mar 2024 12:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710875635; x=1711480435; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:references:from:to:cc:subject:date:message-id :reply-to; bh=weZPWHMhruug3mcLn7WxMURa8q6X3fdH+eV4QEA7ck8=; b=RBht9nvNJ80U0K9WIRDI8FzIE7Kc4Aa0pMN5MSmObZtmXlgP2IHKNgJb3TRPPcOMle WguUu62IKifFw25+bFL9n/bxIMG4gjUmiUliRzEKfnSK1AM9Eg06WPg84i2lq9WAc8wo DqP9dPZ7VpbofFD467LrDK0x28R1IQnM7Jtyx+w1psxww/BNRmGWwZicTkMir8+3Xnub HwE0pOQM33LxQe2JFtU6FeBW7+nssXcPejfe8msa03TmhoricizCqjIXuUiPdXQFx3fd LOtpNY+lRod77X2+WAfYwKwVStQcEoO6QsJISxVT+ZkNXLBJX0AbnUgSNGl0juVCvg4S hP/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710875635; x=1711480435; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:references:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=weZPWHMhruug3mcLn7WxMURa8q6X3fdH+eV4QEA7ck8=; b=uiBtQ4o+AIAc3tTlfbpbAplLB3ajN5Yp9OD1veYbUuGEcJDYFHi2xlLYRppxHSl+Aa Y/AiLm3ISr7O5xL4D09p5Vj6AmbMIK6N7ntX2/8h6sCvIGJmqeBYs+bRHDSi69yF0K3c da2vnRh1EeVIUpWqYYcZMtiyZYYV2Lg0l/vNjWyfIdbflEMSPnoLxdUayNJr7tGljher gDtj+NQOdrCXCuIPrBuJFVO/HtKnV/OVjAK3AKiJtzjSBlY7k+D9Sff3Q6B2oiQuXWQd Ya66OS2X2uWRRpwyYT3nnmr2iUHtGr8dGl6L8N812lH/JcUI0kjo0LDju53O/2kLBuPb 1POQ== X-Forwarded-Encrypted: i=1; AJvYcCVHc7NFPHXy+D50HthCONCkzHaXpcbjPb5bj/E+BFb+y3ZxnQMyr02qqAeJmjwbYDy5JxYiBr2ZFwavUBEqbhANoMvZ7CRVOQN9Je9oByjhC64= X-Gm-Message-State: AOJu0YwN8crQq51FEXtuNzXuv3KBvqLAMOfwePnQVNvTFgcZ9vG3IBDn 5uR6TUtwHJ0NEj5BVt37T5gY55sgWoeOstWgxMi6mkqgHjLWIt89MzqgqFFZSJ0= X-Google-Smtp-Source: AGHT+IHIoD3XEP1amre15N2Dh+zjpDGZOw3pDRtxbO+Nfp/6l6iEbv3Vb6D3RL0i2B0HecceFQ8lZg== X-Received: by 2002:a50:d7de:0:b0:568:c6d5:e13a with SMTP id m30-20020a50d7de000000b00568c6d5e13amr3450895edj.15.1710875635097; Tue, 19 Mar 2024 12:13:55 -0700 (PDT) Original-Received: from localhost (62-77-231-86.static.invitel.hu. [62.77.231.86]) by smtp.gmail.com with ESMTPSA id p8-20020aa7c888000000b00567fa27e75fsm6044240eds.32.2024.03.19.12.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 12:13:54 -0700 (PDT) In-reply-to: <05E839F0-736C-42C0-8344-1C8945E90289@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=geza.herman@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317195 Archived-At: Mattias Engdeg=C3=A5rd writes: > 15 mars 2024 kl. 14.35 skrev Herman, G=C3=A9za=20 > : > >> I implemented this idea, here is the latest version (now,=20 >> object_workspace is a Lisp_Object): > > That's considerably slower than before, especially for small=20 > inputs, so it's probably a no-go. Have you benchmarked it? I really doubt that there is a=20 significant performance difference. Maybe it's possible to find=20 some case, where this modification matters a bit, but for most=20 cases, the difference should be negligible. The amount of=20 allocations done is the same in both cases, which is for large=20 files, only 20-30 allocations. Compared to the thousands of=20 allocations for storing the actual Lisp objects. > Here are some remaining tasks: > > 2. Don't allocate any temporary storage before you know that=20 > it's actually necessary. Except for the very-very trivial cases, memory allocation is=20 always necessary. I can lower the allocation sizes, but I don't=20 think it's worth it. We're only talking about sizes of the KB=20 range. > 3. Stop using the object_workspace when not required, which is=20 > everywhere except possibly when reading arrays into Lisp=20 > vectors. object_workspace is necessary whenever a JSON contains an object=20 or array. So basically always.