From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B365B1F548 for ; Thu, 5 Sep 2024 07:40:00 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=Kc4cJxTm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=dE1J35hf; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1725521966; bh=g3YvAnHPG4WlxqFv8jjPrwK4upgFv5xRMGFabV8Ba6U=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=Kc4cJxTmGIdUzP2zfwy07rMN6EwKbDYTYE7rEW/pw1dZ0MaMlYgimamb1V7M/w4q4 mcnI7bKCIPxSY4eX60qmgWPYvlecPiOVZFTy9F2RG8ZfxQhBqR77v41GPQDw8MelrM zHZ+Z3X0+T+gkiABNrEIjSmnGOmqfh3+rr5C5At8= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 5047743DAD for ; Thu, 5 Sep 2024 07:39:26 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=dE1J35hf; dkim-atps=neutral Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id DDFBD43D55 for ; Thu, 5 Sep 2024 07:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=jYzuJNg610f4eDBnmlamVp3vSIF4Eh9LSsyuEIysbk4=; b=dE1J35hf0YSPkpGtDNwInddxXvHoy75DNyfobWXG27Gcrt5QbVAXUuM6MJui52KFyIJd Ay3H4Z0KTMz7dx2KGN5ywuoj7ALJ4EW8K2/4iqG8LhxSqNBVyF0EEQFF3g+uvC8a+yOvKe ra2q52z0G2DFKhzByX5pPnMC4r589MqD8ThWWAnpFlPmwyCcFpeCjbpqso79LTu2yi9n0Y wRLcue+BVc9xWuKqCJ40UWA0aGDycN6IGqj/saQpqOIrmWmaNxG5ee+8Ybm8aHhRLpX0tn Q1OXU8HwvyWVYe3tihOqE1U27q6lBMycqY4Ak4rxe2g1jXXxYkUvHdfA/Ze4zFsw== Received: by recvd-canary-5f99574dcd-cmh6p with SMTP id recvd-canary-5f99574dcd-cmh6p-1-66D96021-8 2024-09-05 07:39:13.447755603 +0000 UTC m=+1243425.730201982 Received: from herokuapp.com (unknown) by geopod-ismtpd-13 (SG) with ESMTP id 2zg4L9WOQZCgW3cPl66ovQ for ; Thu, 05 Sep 2024 07:39:13.360 +0000 (UTC) Date: Thu, 05 Sep 2024 07:39:13 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20707 X-Redmine-Issue-Author: byroot X-Redmine-Issue-Priority: Normal X-Redmine-Sender: matz X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 95698 X-SG-EID: =?us-ascii?Q?u001=2Eqca74XLbbBG2T0HhbEZgBN9E1Qhb0c7bGBe1waNAWdTreSqyWPDekZUgq?= =?us-ascii?Q?NYk4+nm=2F0VIqwc8ZBTQxqk7G=2FctsRLtYG2yTl=2FP?= =?us-ascii?Q?2CaGNETxG2T+k1kimzmzm3oGJmSo3JXbvORi0IK?= =?us-ascii?Q?wjHz=2FNbuvGK7QAV8n=2Fglk1bgkEB+ESAjPpLYA+d?= =?us-ascii?Q?5ZHamQcCrIY=2FvTaOjnmjlLiToiuSqugbEP4adqe?= =?us-ascii?Q?BHXEUKDqGJHHk8N1fciYjbiXJ5nwOsJar7cxf4p?= =?us-ascii?Q?0j1vy5htoF7HkJAWnerhw4dVeQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: EKMWGWAAZQAOUTSIAKJE6OTWADLSXA34 X-Message-ID-Hash: EKMWGWAAZQAOUTSIAKJE6OTWADLSXA34 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119058] [Ruby master Feature#20707] Move `Time#xmlschema` into core List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "matz (Yukihiro Matsumoto) via ruby-core" Cc: "matz (Yukihiro Matsumoto)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20707 has been updated by matz (Yukihiro Matsumoto). Accepted. Matz. ---------------------------------------- Feature #20707: Move `Time#xmlschema` into core https://bugs.ruby-lang.org/issues/20707#change-109636 * Author: byroot (Jean Boussier) * Status: Open ---------------------------------------- ### Performance Converting `Time` into `RFC3339 / ISO8601` representation is an significant hotspot for application that serialize data in JSON, XML or other formats. Right now this feature is currently available through the `time` default gem, so it rely on `Time#strftime`. While [`strftime` could certainly be optimized](https://github.com/ruby/ruby/pull/11508), ultimately it's a very generic API so can't make a lot of assumptions about the output. Whereas `ISO8601` is a very strict format, with very few dynamic part, so it's much easier for dedicated code to be well optimized, as the final size of the string can be computed upfront etc. [I experimented with this and was able to get a ~5x speedup with a fairly straightforward implementation](https://github.com/ruby/ruby/pull/11510). ``` compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a62) +YJIT [arm64-darwin23] built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23] warming up...... | |compare-ruby|built-ruby| |:-----------------------|-----------:|---------:| |time._xmlschema | 1.087M| 5.190M| | | -| 4.78x| |utc_time._xmlschema | 1.464M| 6.848M| | | -| 4.68x| |time._xmlschema(6) | 859.960k| 4.646M| | | -| 5.40x| |utc_time._xmlschema(6) | 1.080M| 5.917M| | | -| 5.48x| |time._xmlschema(9) | 893.909k| 4.668M| | | -| 5.22x| |utc_time._xmlschema(9) | 1.056M| 5.707M| | | -| 5.40x| ``` ### Usability Aside from the performance reason, `ISO8601` is so common that having this functionality built-in without needing to require anything would make sense to me. `xmlschema` is the most common reason why I require `time`, and in many case having it core would allow not to load it at all. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/