[REBOL] Re: Slight Rebol performace comparison ...
From: petr:krenzelok:trz:cz at: 13-Jun-2001 9:37
Joel Neely wrote:
> Hi, Petr,
>
> Just one quick observation...
>
> Petr Krenzelok wrote:
> >
> > Ryan Cole wrote:
> >
> > > Great story Petr!
> >
> > I copied/appended test source today to some final size of
> > 21 MB and was interested in performance tests once again:
> >
> > VO code - 38 sec
> > Rebol code - 35 sec (rebol start not measured, but Rebol
> > still nicely compares to compiled language (VO uses native
> > code - no p-code))
> >
>
> Based on some benchmarking I did a couple of years ago (in
> Java, if anyone was curious) the performance consequencess of
> different I/O buffering schemes (i.e., character-at-a-time,
> line-at-a-time, big-buffer-at-a-time, or all-input-at-once)
> can easily dominate total run time, swamping any performance
> gains from compilation vs. interpretation for file-oriented
> (non-compute-bound) processes.
>
> We know what REBOl does about
>
> my-file-data: read %somefile.data
>
> but do you know what type of I/O scheme your collegue's VO
> program was using?
:-)
METHOD Start() CLASS App
LOCAL path,cTemp AS STRING
LOCAL fFil AS PTR
LOCAL fVys AS PTR
Zprava(,"Pracuje se na tom","Necum","X",FALSE)
path:=WorkDir()
IF (fVys:=FCreate("vystup.txt",FC_NORMAL))<>F_ERROR
IF (fFil:=FOpen("pokus.txt",FO_READ))<>F_ERROR
DO WHILE !FEof(fFil)
cTemp:=FReadLine(fFil)
IF Len(AllTrim(cTemp))<>0 .and. Left(cTEmp,5)<>"NAZEM" .and.
Left(cTEmp,5)<>"=====" .and. Left(cTEmp,1)<>CHR(12)
// zapsat radek
FWriteLine(fVys,cTemp)
ENDIF
ENDDO
ENDIF
ENDIF
TextYes(,"Prace dokoncena.")
SELF:quit()
As you can see, VO provides low level enough file handling functions
.... The question is, what does FReadLine does, but on the other hand
Rebol, even when /direct is used, reads some data into port/state/buffer
...
My code follows:
REBOL []
start: now/time
zdroj: open/direct/lines %pokus.txt
cil: open/direct/lines %vyslx.txt
while [line: copy/part zdroj 1][
tmp: copy/part first line 5
if all [(not empty? trim/all copy first line) (tmp <> "NAZEM") (tmp <>
=====
) ((to-char first tmp) <> (to-char 12))][
insert tail cil first line
]
]
close cil
close zdroj
write %time.log now/time - start
-pekr-