Hello!
I've got my first test results, and I'm having some doubts.
The following code runs almost 200 seconds on a 20Mb file:
"file-name.csv" [ utf8 [ input-stream get
[
EBNF[=[
quotedColumn = "\""~ (!("\"") .)* "\""~ quotedColumn*
=> [[ first2 swap prefix [ >string ] map "\"" join ]]
unquotedColumn = (!("\t") .)*
column = ( quotedColumn | unquotedColumn ) => [[ >string ]]
rule = column ( "\t"~ column )* => [[ first2 swap prefix ]]
]=] ,
] each-stream-line
] with-file-reader ] { } make
The following equivalent code using the csv vocab runs about 2 seconds on the
same file:
"file-name.csv" [ utf8 [ input-stream get CHAR: \t [
[ string>csv [ first , ] unless-empty ] each-stream-line
] with-delimiter ] with-file-reader ] { } make
The difference is 100x, and the question is: is the speed difference related
to the fact that I'm running the code in the Listener? Could it be that if I
put it all into a vocab as opposed to running interactively it would get better
optimized and reach the performance of the csv vocab?
---=====---
Александр
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk