zsh-workers
 help / color / mirror / code / Atom feed
* Add redis-db module to upstream?
@ 2017-06-03  3:24 Sebastian Gniazdowski
  2017-06-03 17:09 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Gniazdowski @ 2017-06-03  3:24 UTC (permalink / raw)
  To: zsh-workers

Hello
The module https://github.com/zdharma/zredis is interesting because:

- needs only hiredis package, which is a small modern-C-style library
    - for example it uses sds string library https://github.com/antirez/sds which has a header stored before pointers passed around, making them both C-strings and custom structures (with length stored)

- is well tested – complete coverage in test suite, also separate test suite for testing with Valgrind

- exercises all Zsh data types, so other module creators will have a nice example code

- has a use case – I imagine db administrator binding key "visitors" to Zsh scalar parameter $visitors, to do echo $visitors many times across the day

If we will agree on adding this module I will sent a patch including update of configure.ac. I would still distribute my module, because it can be loaded into Zsh without recompilation of Zsh, and to any Zsh version.

Distributing with Zsh would boost awareness of what Zsh can do. Someone could be inspired by this module if in upstream, while I see it being ignored if only as a plugin.

--
Sebastian Gniazdowski
psprint /at/ zdharma.org


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Add redis-db module to upstream?
@ 2017-06-08  4:01 Sebastian Gniazdowski
  0 siblings, 0 replies; 12+ messages in thread
From: Sebastian Gniazdowski @ 2017-06-08  4:01 UTC (permalink / raw)
  To: Bart Schaefer, zsh-workers

On 8 czerwca 2017 at 00:10:20, Bart Schaefer (schaefer@brasslantern.com) 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-06-09 16:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-03  3:24 Add redis-db module to upstream? Sebastian Gniazdowski
2017-06-03 17:09 ` Bart Schaefer
2017-06-03 19:35   ` Daniel Shahaf
2017-06-04  5:57     ` Sebastian Gniazdowski
2017-06-04  6:23       ` Sebastian Gniazdowski
2017-06-06  2:28     ` Eric Cook
2017-06-07  9:29     ` Oliver Kiddle
2017-06-07 11:08       ` Sebastian Gniazdowski
2017-06-07 13:04       ` Daniel Shahaf
2017-06-07 22:10       ` Bart Schaefer
2017-06-04  8:35   ` Sebastian Gniazdowski
2017-06-08  4:01 Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).