|
|
Choosing A Webhost: |
Re: Two poorly optimized functions in SQLParser.java: msg#00393apache.db.derby.devel
I am merely suggesting that it would be more efficient if JavaCC produced It's time for me to out myself. I wrote most of sqlgrammar.jj, along with a lot of the other Cloudscape/Derby language code. I no longer work on Cloudscape or Derby, but I'm still interested in it. The code in SQLParser.java consists mostly of rules from sqlgrammar.jj and lookahead code. I suspect the massive nested if statements are for lookahead. sqlgrammar.jj uses a single token of lookahead by default. The first implementation of sqlgrammar.jj used numeric lookahead to disambiguate the grammar. That is, where javacc would report that more tokens of lookahead were needed, I would put in LOOKAHEAD(2) (or 3 or 4, or whatever javacc suggested). This led to a very large parser. The javacc development team told me that the size of the parser would be reduced significantly if, in those places where more than one token of lookahead is needed, we used semantic lookahead rather than numeric lookahead. What that means is that, where the grammar is ambiguous with a single token of lookahead, we use a hand-written method for lookahead rather than tell javacc to look ahead two or more tokens. When I made this change, the number of generated methods starting with "jj_" shrank significantly. I suspect the ugly massive nested if statements in SQLParser.java have to do with lookahead. I thought that maybe someone had put in some numeric lookahead, but I didn't find any such thing when I looked through sqlgrammar.jj. It's possible that I missed something, though. In any case, it would help to have the complete call stack for the methods in question. I am particularly interested in which grammar rules are calling these methods. Given that, I might be able to figure out what's going on by looking at sqlgrammar.jj - Jeff Lichtman swazoo-KealBaEQdz4@xxxxxxxxxxxxxxxx Check out Swazoo Koolak's Web Jukebox at http://swazoo.com/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Two poorly optimized functions in SQLParser.java, Dain Sundstrom |
|---|---|
| Next by Date: | Re: Two poorly optimized functions in SQLParser.java, Daniel John Debrunner |
| Previous by Thread: | Re: Two poorly optimized functions in SQLParser.java, Dain Sundstrom |
| Next by Thread: | Re: Two poorly optimized functions in SQLParser.java, RPost |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |