2006-06-16

First draft

I've been working on a header search tool in Python. You run the index tool, and it creates the database (using PostgreSQL and PyGreSQL); then you can use the search tool to look up headers either by name or by keyword:

python searchheaders.py name=NSAffineTransform.h  %~/Python/sql_headersearch(0)
NSAffineTransform.h     /System/Library/Frameworks/AppKit.framework/Headers/NSAffineTransform.h
NSAffineTransform.h     /System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h
___
python searchheaders.py symbol=NSAffineTransform  %~/Python/sql_headersearch(0)
NSAffineTransform       "/System/Library/Frameworks/AppKit.framework/Headers/NSFontDescriptor.h"
NSAffineTransform       "/System/Library/Frameworks/AppKit.framework/Headers/NSBezierPath.h"
NSAffineTransform       "/System/Library/Frameworks/AppKit.framework/Headers/NSAffineTransform.h"
NSAffineTransform       "/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h"
NSAffineTransform       "/System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h"

It's not done yet, obviously (for one thing, I don't know why those quotes are in there), but it's coming along nicely. And it's quick, though not very:

time python searchheaders.py name=NSAffineTransform.h > /dev/null
python searchheaders.py name=NSAffineTransform.h > /dev/null  0.06s user 0.10s system 44% cpu 0.371 total
___
time python searchheaders.py symbol=NSAffineTransform > /dev/null  
python searchheaders.py symbol=NSAffineTransform > /dev/null  0.06s user 0.10s system 6% cpu 2.339 total

I want to see if there's anything I can do to fix that query time. Probably something involving PostgreSQL's array types, so that I can make the keyword column a primary key.

This, incidentally, is why I needed to parse the preprocessor.

Technorati tags: .

0 comments:

Post a Comment

<< Home