[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question: estimating size of a buffer when written to file?
From: |
Qiantan Hong |
Subject: |
Re: Question: estimating size of a buffer when written to file? |
Date: |
Wed, 8 Dec 2021 17:09:30 +0000 |
> How 'bout your first encode the buffer's content and then write it
> instead of relying on the write to do the encoding?
> This way you get to see the size trivially.
I just found the function encode-coding-region, I never knew it exists, thanks!
The log will eventually gets written out so this is good enough.
BTW, after second thought, I think this is probably a premature optimization.
What about not care about locking at all in the kv-store APIs and let
package author do it?
On the other hand, I’m currently implementing a high level persistent-variable
API that runs in idle timer. I can easily lock/unlock only once every idle timer
event (instead of before/after every kv-put) and now the cost should be
negligible.