]> gitweb.factorcode.org Git - factor.git/commitdiff
"H{ } substitute" is faster than "{ } substitute".
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 14 Jul 2012 02:06:38 +0000 (19:06 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 14 Jul 2012 02:06:38 +0000 (19:06 -0700)
basis/colors/constants/constants.factor
basis/tools/test/test.factor
basis/ui/text/pango/pango.factor
basis/ui/tools/listener/completion/completion.factor
basis/unicode/data/data.factor
core/vocabs/loader/loader.factor
extra/mason/platform/platform.factor
extra/svg/svg.factor
unmaintained/alien/cxx/cxx.factor
unmaintained/alien/inline/types/types.factor
unmaintained/alien/marshall/structs/structs.factor

index 6f1b3cb951fc796a1a7d565f59fd9dc402f46527..14d3e0ad1aaebb23d16bec19bd94dd88aa1b11ed 100644 (file)
@@ -9,7 +9,7 @@ IN: colors.constants
 : parse-color ( line -- name color )
     first4
     [ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
-    [ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
+    [ blank? ] trim-head H{ { CHAR: \s CHAR: - } } substitute swap ;
 
 : parse-colors ( lines -- assoc )
     [ "!" head? not ] filter
index b85bf2a84a9506f8545efde4ac8311d84e1528fb..d36637f36c50a2a796e0b209b022d4bf674cd713 100644 (file)
@@ -77,7 +77,8 @@ M: did-not-fail summary drop "Did not fail" ;
     [ { } quot with-datastack drop did-not-fail t ] [ drop f f ] recover ;
 
 : experiment-title ( word -- string )
-    "(" ?head drop ")" ?tail drop { { CHAR: - CHAR: \s } } substitute >title ;
+    "(" ?head drop ")" ?tail drop
+    H{ { CHAR: - CHAR: \s } } substitute >title ;
 
 MACRO: <experiment> ( word -- )
     [ stack-effect in>> length dup ]
index 9b404487371b72b561922a4c8c314da7ab1efa22..48868523d876ab625bc2c9e269006a0a5409fde1 100644 (file)
@@ -120,7 +120,7 @@ SYMBOL: dpi
 : escape-nulls ( str -- str' )
     #! Replace nulls with something else since Pango uses null-terminated
     #! strings
-    { { 0 CHAR: zero-width-no-break-space } } substitute ;
+    H{ { 0 CHAR: zero-width-no-break-space } } substitute ;
 
 : unpack-selection ( layout string/selection -- layout )
     dup selection? [
index 6187c64f89cb458bbd2bf15df3173735130546f5..c303c1f34c1730f5b9e60b078d4c3c2f22100df5 100644 (file)
@@ -17,7 +17,7 @@ SLOT: history
 
 : history-list ( interactor -- alist )
     history>> elements>>
-    [ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
+    [ dup string>> H{ { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
     <reversed> ;
 
 : history-completions ( short interactor -- seq )
index 830422c76761ffbb4cac815edd8502be6c806f6c..e8bed172a78d190b0dbf49d7473c8eddb99ff9ce 100644 (file)
@@ -158,7 +158,7 @@ PRIVATE>
 
 : process-names ( data -- names-hash )
     1 swap (process-data) [
-        >lower { { CHAR: \s CHAR: - } } substitute swap
+        >lower H{ { CHAR: \s CHAR: - } } substitute swap
     ] H{ } assoc-map-as ;
 
 : multihex ( hexstring -- string )
index 5e097ecc6c68077b1e31b267a63da42b30f97d31..fec916667e577329bd05152321b2fcdba01fecce 100644 (file)
@@ -42,7 +42,7 @@ M: string vocab-path ( string -- path/f )
 PRIVATE>
 
 : vocab-dir ( vocab -- dir )
-    vocab-name { { CHAR: . CHAR: / } } substitute ;
+    vocab-name H{ { CHAR: . CHAR: / } } substitute ;
 
 : append-vocab-dir ( vocab str/f -- path )
     [ vocab-name "." split ] dip
index 0c52a8cd3eaabaa84593ea2c4fdd1fd14d2cb721..6dd5dc88cef54c813a1740e78b136ac6b811a22d 100644 (file)
@@ -5,7 +5,7 @@ mason.config bootstrap.image assocs ;
 IN: mason.platform
 
 : (platform) ( os cpu -- string )
-    { { CHAR: . CHAR: - } } substitute "-" glue ;
+    H{ { CHAR: . CHAR: - } } substitute "-" glue ;
 
 : platform ( -- string )
     target-os get name>> target-cpu get name>> (platform)
index 2d2d38314ab6e2f2ac119dba67a753c9c24f2a93..bebed0a0f8aeadee36bd47a34593a3ebc816389a 100644 (file)
@@ -10,7 +10,7 @@ XML-NS: sodipodi-name http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
 XML-NS: inkscape-name http://www.inkscape.org/namespaces/inkscape
 
 : svg-string>number ( string -- number )
-    { { CHAR: E CHAR: e } } substitute "e" split1
+    H{ { CHAR: E CHAR: e } } substitute "e" split1
     [ string>number ] [ [ string>number 10^ ] [ 1 ] if* ] bi* *
     >float ;
 
index 9d0ee24f505f6df8c400162e8e1529189bc5f204..1e788d47137192d2b00d4888d1c87a5f624231d7 100644 (file)
@@ -24,7 +24,7 @@ PRIVATE>
     add-mixin-instance define-class-tuple ;
 
 :: define-c++-method ( class-name generic name types effect virtual -- )
-    [ name % "_" % class-name { { CHAR: : CHAR: _ } } substitute % ] "" make           :> name'
+    [ name % "_" % class-name H{ { CHAR: : CHAR: _ } } substitute % ] "" make           :> name'
     effect [ in>> "self" suffix ] [ out>> ] bi <effect> :> effect'
     types class-name "*" append suffix                  :> types'
     effect in>> "," join                                :> args
index ac7f6ae17f4252d94281f44d5b1d497b6b09bbd7..fe4e31f1fde251b4beb58c4f9eb183f16927e20f 100644 (file)
@@ -7,7 +7,7 @@ IN: alien.inline.types
 
 : cify-type ( str -- str' )
     dup word? [ name>> ] when
-    { { CHAR: - CHAR: space } } substitute ;
+    H{ { CHAR: - CHAR: space } } substitute ;
 
 : factorize-type ( str -- str' )
     cify-type
index 3f9c8e3a7ef09206565b249e249436b95d653733..fff84e9c04d10efa34d77f2ccef7512b509f6677 100644 (file)
@@ -41,7 +41,7 @@ PRIVATE>
     name c-type fields>> [
         class swap
         {
-            [ name>> { { CHAR: space CHAR: - } } substitute ]
+            [ name>> H{ { CHAR: space CHAR: - } } substitute ]
             [ type>> ] [ reader>> ] [ writer>> ]
         } cleave define-struct-accessors
     ] each ;