Talk:Why does my script take hours to compile?
FyreWulff My scripts take too long to compile. It's only 88,213 lines of code. It takes near 20 minutes to compile them. I've resorted to renting time on IBM's supercomputers to compile them, but that only cuts it down to 10 minutes.
Bob the Hamster I think the main problem is that I wrote the hspeak code without worrying about how it uses memory. When I needed to store something, I just put it into a gigantic sequence (in Euphoria, sequence==array) and I don't clean up those giant arrays. If it worked with streams rather than arrays, it would probably be much more efficient-- unfortunately Euphoria does not support streams (that I know of). Anyway, memory usage increases polynomialy as the script gets bigger :( The solution, IMHO, is to re-write hspeak in python... but that is a big project, which I'm not happy about jumping into yet.
Mike C. Why python? I think that the utilities that support the OHR should be written in the same language as the OHR. No no, not QB. ;)
Sure, FB isn't designed for working with streams. But, it does have the facilities to smush lines, and then tokenizing it is trivial from there. You would have to store keywords and what not in a different way (probably an array of zstring ptr's, the searching of which would probably be an O(log n) operation).
Finally, Python is still an interpreted language. I cannot forsee a properly written compiler in FB being slower than one in Python, for the simple reason that FB compiles to machine code, and not whatever bytecode + interpreter Python may produce.
(Also, Fyre, I think many people (myself included) would consider almost 90 thousand lines of code to be alot)
The Mad Cacti: Rewriting HSpeak in FB because the rest of the engine is coded in it seems unnecessary to me... use whatever is most natural.
I think it could be possible to optimise HSpeak without major rewrites. Sometime I'll look at it.
Mike C. Oh, I forgot one other reason: I don't know python, and don't have the time to learn, etc. That said, everything I know of euphoria was from hspeak, so...
Bob the Hamster: Using the right tool for the job is more important than using the same tool for every job. Python is fantastic for language parsing.
As for speed concerns, a good design in a slow language is better than a bad design in a fast language. Freebasic's features and available data types don't provide us much advantage over the euphoria version, but python has lost of parser features that would make a good design easier. Also, as for python being slow, read http://psyco.sourceforge.net/