Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Add redis-db module to upstream?



On 8 czerwca 2017 at 00:10:20, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> rather than further overloading typeset. We need a way to select
> the module (ztie -d ...) and to specify external objects (ztie -f

Current option set:

Usage: ztie -d db/... [-z] [-r] [-p password] [-P password_file] -f/-a {db_address} {parameter_name}
Options:
 -d:       select database type: "db/gdbm", "db/redis"
 -z:       zero-cache for read operations (always access database)
 -r:       create read-only parameter
 -f or -a: database-address in format {host}[:port][/[db_idx][/key]] or a file path
 -p:       database-password to be used for authentication
 -P:       path to file with database-password

Also, -l for "load password", for the password mechanism. Not so cool mnemonic ("load"), maybe a better one can be invented.

> store in a simple attibute-value database. Specifically to zsh it can
> be used to share state among shells (for example IF we could rely on it

I heard fish has the universal variables, shared among sessions. Too bad I don't know how to do typeset -F SECONDS=0 there, I would compare performance there too:

echo ${#redis_list}; typeset -F SECONDS=0; repeat 1000; do local -a copy=( $redis_list ); done; echo $SECONDS
1100
1.4957760000

local_list=( $redis_list )
typeset -F SECONDS=0; repeat 1000; do local -a copy=( $local_list ); done; echo $SECONDS
0.5719420000

So not that bad, x2.6. For array of 5 elements:

typeset -F SECONDS=0; repeat 1000; do local -a copy=( $redis_list ); done; echo $SECONDS
0.1843630000
typeset -F SECONDS=0; repeat 1000; do local -a copy=( $local_list ); done; echo $SECONDS
0.0125850000

That's 14.6 times slower, but only 0.000184s per access. So not even a 1 ms time. This was for system under load (compilation of Emacs), without load the 1100 results are the same, while for 5 elements, it's: 0.1277 vs. 0.009106, x14, 0.0001277 per access.

Cool idea about the clustering mechanism.

--
Sebastian Gniazdowski
psprint /at/ zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author