optimizations

This commit is contained in:
Daniella / Tove 2022-05-17 20:29:24 +02:00
parent d42bb09576
commit 0818de0421
2 changed files with 14 additions and 13 deletions

View file

@ -280,9 +280,10 @@ func acopy {
def arr2 =arr2 def arr2 =arr2
def arr1 =arr1 def arr1 =arr1
def i 1 neg =i def i 0 =i
while { ( i ++ =i ) ( i len lt ) } { while { i len lt } {
arr2 ( i idx2 + ) ( arr1 ( i idx1 + ) aget ) aput arr2 ( i idx2 + ) ( arr1 ( i idx1 + ) aget ) aput
i 1 + =i
} }
arr2 arr2

View file

@ -23,18 +23,18 @@ func stream.readline {
def id =id def id =id
def byte 0 =byte def byte 0 =byte
def array 0 anew =array def array 0 anew =array
def tmparray 0 anew =tmparray
def i 1 neg =i def i 1 neg =i
id STREAM.read stream =byte [
id STREAM.read stream dup =byte _char
byte -1 eq if { byte -1 eq if {
] pop
-1 -1
2 stop 2 stop
} }
while { ( i 1 + =i ) ( byte 10 eq not ) } { while { ( i 1 + =i ) ( byte 10 eq not ) } {
array ( ( array alen 1 + anew ) dup =tmparray ) 0 0 ( array alen ) acopy =array id STREAM.read stream dup =byte _char
array dup alen 1 - byte _char aput
id STREAM.read stream =byte
} }
] =array
array alen 0 eq if { array alen 0 eq if {
array _string array _string
2 stop 2 stop