Created
October 15, 2024 12:52
-
-
Save timo/a449313a12a46948b453751b68fed5d2 to your computer and use it in GitHub Desktop.
make zef a good bit faster at going through boatloads of distributions, like with `zef list`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ec6b768d98245d7b011a4900ea904ede4e4ee4ee Mon Sep 17 00:00:00 2001 | |
From: Timo Paulssen <timonator@perpetuum-immobile.de> | |
Date: Tue, 15 Oct 2024 14:50:35 +0200 | |
Subject: [PATCH] Micro-optimize Zef::Distribution!long-name | |
in pre-RakuAST, sprintf is relatively expensive. | |
--- | |
lib/Zef/Distribution.rakumod | 10 +++++----- | |
1 file changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/lib/Zef/Distribution.rakumod b/lib/Zef/Distribution.rakumod | |
index 0b36df2..836b1a8 100644 | |
--- a/lib/Zef/Distribution.rakumod | |
+++ b/lib/Zef/Distribution.rakumod | |
@@ -213,11 +213,11 @@ class Zef::Distribution does Distribution is Zef::Distribution::DependencySpecif | |
} | |
method !long-name($name --> Str) { | |
- return sprintf '%s:ver<%s>:auth<%s>:api<%s>', | |
- $name, | |
- (self.ver // ''), | |
- (self.auth // '').trans(['<', '>'] => ['\<', '\>']), | |
- (self.api // ''), | |
+ return $name | |
+ ~ ':ver<' ~ (self.ver // '') | |
+ ~ '>:auth<' ~ (self.auth // '').trans(['<', '>'] => ['\<', '\>']) | |
+ ~ '>:api<' ~ (self.api // '') | |
+ ~ '>' | |
; | |
} | |
-- | |
2.46.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment