Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro expander stresses symbol table #810

Open
WillClinger opened this issue Jul 20, 2017 · 3 comments
Open

macro expander stresses symbol table #810

WillClinger opened this issue Jul 20, 2017 · 3 comments

Comments

@WillClinger
Copy link
Member

After figuring out why the sample implementation of SRFI 148 doesn't work in Larceny (it assumes a lack of hygiene when distinguishing between pattern variables and literals), I looked into why it and other macro-intensive SRFIs take so long to compile. It turns out that compilation, mostly macro expansion, creates about 800000 symbols, of which only 5000 or so need to be retained following compilation.

Reclaiming those symbols via gctwa takes about ten minutes on our main Linux machine, which is about six times as long as the compilation itself. Calling gctwa a second time takes only 75 ms.

The colors generated during macro expansion don't have to be symbols, but using symbols to represent colors appears to increase the number of generated symbols by only 10% or so.

@lars-t-hansen
Copy link
Member

gctwa's filtering looks like it's quadratic in the length of the oblist :(

@WillClinger
Copy link
Member Author

Changeset 1a06296 makes gctwa run in linear time, reducing the ten minutes to 600 ms, a hundred-fold speedup.

@WillClinger
Copy link
Member Author

Changeset 3bef27e makes gctwa interruptible by using a crude hash table instead of property lists. With property lists, a user interrupt would prevent marked symbols from being reclaimed by a subsequent gctwa.

Using a hash table also appears to be slightly faster, but that's much less important.

Improving the performance of gctwa doesn't solve the problem identified by this issue ticket, but it should make the problem easier to deal with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants