Thank you for the information on jtpreparse(). I notice it took a long time to load scripts, eg, I have a script of size about 3MB that took 3 to 10 second to load. If/when your work on "first execution" can be done, will it be possible to add another global parameter to defer jtpreparse() to the first execution (current behavior is good for development).
Вт, 21 июн 2016, Henry Rich написал(а): > I agree with your logic, but there is a problem, which I am encountering > while working on something else. > > [And also FYI, a considerable amount of processing is done when a definition > is loaded, in jtpreparse(), which maps out all the control words] > > I am working on an overhaul of symbol-table operations to (1) make > references to local symbols much faster; (2) avoid the overhead of > allocate/fill/free that currently occurs every time an explicit definition > is executed. > > My approach is to create a symbol table and let it hang around after > execution, to be used next time the definition runs. > > I wanted to create this table on first execution, just as you suggest, but > my problem is, How do I point to it? It's not easy to create a new data > structure in the JE, and the explicit definition seems to use all the fields > except gs which I think needs to be kept at 0. > > The hs field points to a 6-box array containing the results of preparse(). > I can add my new symbol table there, but then I need to make sure its > usecounts are the same as the rest of hs, because otherwise as the verb gets > assigned or deleted I might lose the symbol table. > > So, I have to create the symbol table at load time, the same time preparse() > runs. There's just no way I can see to wait till the first execution. I > don't think the overhead is material for the local symbol table. It might > be a different story for preparsed parenthesized nouns. > > Henry > > On 6/21/2016 8:12 PM, bill lam wrote: > > IMO only small portion of code (say 20%) of a non-trival program > > will be actively used. The extra time needed for loading > > scripts that will seldom used is wasteful. Perhaps you may > > defer to pre-parse stage to the first execution of explicait > > definition. Timing benchmark is helpful here. > > > > I worry the extra space allocated that will not freed, a promise > > would be affect expressions that involving no nouns (other than > > primitive nouns a. a:) > > > > Since this is an implementation detail, not a language feature, > > I think it should be turn on/off by a global parameter. > > > > Пн, 20 июн 2016, Henry Rich написал(а): > > > It occurs to me that in explicit definitions, parenthesized expressions > > > that > > > contain only primitives could be parsed at definition time and replaced > > > with > > > a single word in the queue. This would save parsing time during execution. > > > The only downside I can see is that something like (<1000 1000 $ a:) would > > > tie up a lot of memory - maybe I would have to check for that. > > > > > > Any other objections? > > > > > > Henry > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm