On 24/02/2008, Attila Lendvai attila.lendvai@gmail.com wrote:
baah, i fooled myself with an old change of mine. and in the light of the compiler macro i think this is BS and should be rolled back. i've unpulled stuff from my repo and amended the patches according to this mail.
Sun Feb 24 01:16:39 WET 2008 attila.lendvai@gmail.com * Added a compiler macro for lookup-mapping
Hmm, the compiler macro also checks if encoding is a concrete-mapping. Did that slip through or is it intentional?
Does this compiler macro kick in when string-to-octets is inlined? Otherwise, there isn't much point. But if it does kick in I can imagine how inlining might be desirable if we're converting a bunch of strings in a tight loop. Doing some profiling to check whether it is in fact worthwhile would be nice, though.
I'm being paranoid because I got bitten by a (possibly premature) optimization patch in CFFI some time ago. :-)
Sat Feb 23 22:48:45 WET 2008 attila.lendvai@gmail.com
- Added an exported lookup-string-vector-mapping for special uses
of the encoders directly
[...]
all i have now is the buffer reuse idea, which does not really balance an exported symbol. so let's scratch that lookup-string-vector-mapping patch for now.
I don't have anything against the patch per se. The mappings have an exported, albeit low-level, interface anyway. I'm just curious what it's for because I'd probably prefer to add that functionality in string-to-octets in a more convenient way.
another interesting usecase i was considering is an encoder that can write into a (socket) stream using a local byte vector buffer and call write-sequence when the buffer gets full. calling write-byte is damn slow... but this is more like a random optimization idea than something really needed.
Ah yes, iolib should definitely do that. But why isn't that doable with string-to-octets? To put it in another way, what would be necessary to make that doable with string-to-octets? Would adding a vector argument and returning the number of characters consumed and number of bytes output as extra return values be enough?
BTW, I've pushed your patches to the main tree. Yesterday, I had pushed them to the old tree in my c-l.net home by mistake.