gherkin icon indicating copy to clipboard operation
gherkin copied to clipboard

read performance

Open alandipert opened this issue 12 years ago • 4 comments

read is currently very slow, and likely the slowest part of program loading. Currently, reading core.gk results in 100+ subshells - probably because we subshell in readline and perform various tricks in order not to lose whitespace.

Any boost in read performance while retaining the ability to read whitespace characters is killer.

alandipert avatar Nov 26 '13 01:11 alandipert

How dow you feel about a dependency on awk? Perl?

abrooks avatar Nov 28 '13 22:11 abrooks

Awk is a posix standard.

Sent from my iPhone

On Nov 28, 2013, at 5:06 PM, Aaron Brooks [email protected] wrote:

How dow you feel about a dependency on awk? Perl?

— Reply to this email directly or view it on GitHub.

joelmccracken avatar Nov 28 '13 23:11 joelmccracken

Perl may not always be available. One of the reasons for Gherkin is for those environments where you don't know what you may have (Bash 4 is a bit of an ask, but ultimately every new system should have it by default).

Gherkin is already based on AwkLisp. It seems to me that if we're happy being dependent on Awk, then we would be better served by simply extending that project (which would be MUCH easier to do).

The readLine function is currently calling out to external programs (grep, tail, tr), which is NOT what we want... and it makes the reader very slow. However, no one has quite figured out how to avoid this yet (one attempt was close, but couldn't deal with * characters, IIRC). Other than that one line, I don't think we rely on external programs anywhere.

quoll avatar Nov 29 '13 02:11 quoll

@kanaka has made incredible progress in his experimentation with tokenization instead of character pushback. While our "string-mapped" file reader is about 40% faster than the interactive read-based one, Joel's current approach could bring us another 2x and also scales linearly with input. For latest progress, see his tokenizer.sh

alandipert avatar Dec 06 '13 21:12 alandipert