Let's start Scheme

2012-04-10

Memo: Cache reader improvement

Since Sagittarius supports SRFI-4 (well, it's not released yet), the cache reading problem is totally floated up.

Before I describe the problem, I need to write how exactly the cache mechanism works. The reason why Sagittarius has cache is because of performance improvement. Let's say when (rnrs) library is loaded, then related libraries are also loaded (of course). However Sagittarius does not have compiled base library like Ypsilon and mosh have. So each time these library are loaded, compiler is also invoked. This caused really bad performance problem. So I introduced the cache mechanism.
However it is not completely done and I was searching what is the better solution for it. Right now, when Sagittarius load a library, it tries to find the cache first and if it can not find then compile the real library and write its cache.
Then what if there is a non cachable object in the compiled code. Yes, this is the problem. You can simply try how to make invalid cache code. Write a reader macro and let it return a hashtable (yes,  even hashtable can not be cached.) Current implementation has no space to expand the behaviour.

What I am thinking is adding two slots to base classes like 'readCache' and 'writeCache'. It is possible since Sagittarius has supported CLOS. Then introduce <fasl> class to allow user to write own cache reader. I am planing to implement this in 0.3.2 but I'm not sure if I can...

No comments:

Post a Comment