Skip to content
Tcl Source Code View Ticket
Login

View Ticket

zipfs RFE

Open7aee6028491a9c7e05e4de86cfbac1eb13310a2cCreated 6 years agoUpdated 6 years ago
Descriptionplain2021-04-18 13:54:09
dkf, from the latest commits regarding zipfs I see you're planning a
new TIP. Comparing the current state of affairs with my AndroWish
zipfs version what about considering these enhancements:

* improving glob performance by having real directories
(ZipDirEntry structs as a subclass of ZipEntry structs)
with a hash for children

* weak symbol trickery to support linking ZIPs as an object file,
i.e. use "objcopy -I binary" to make an object with a read-only
byte array which can be mounted

* support for loading native code from /dev/shm or memfd which are
available on various BSDen and Linuxen and allow to eliminate copies
of shared libraries to temporary files
jan.nijtmanswiki2021-04-26 07:18:33

Chrisian, I would be happy to sponsor this and help you with the TIP/implementation. Any patches you can offer already? About "weak symbol trickery", it's not clear to me how it could be useful (at least not on Windows/Linux, neither on MacOS since we have Marc Culler's "macher" utility already ...). But for the other two, I certainly see the added value.

chwplain2021-04-26 09:01:18
* to give an overview on /dev/shm or memfd loading see these sections from
  AndroWish's zipfs implementation:

https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=636-957
https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=5651-5822

  This is based on 8.6 and needs certainly some work to be part of the
  current core-8-branch and trunk.


* the weak symbol idea is in

https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=418-439
https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=1630-1684

  and when used consequently would allow to generate a ZIP at build time, transform
  it to an object file as an "unsigned char" byte array with known name, and finally
  link that object to an executable or a shared library. If the function to mount
  a byte array as a ZIP is available per Tcl's stub table, the same technique can
  be used in arbitrary Tcl extensions with native code. This works equally well on
  the three main platforms and would simplify distribution of Tcl extensions which
  finally can be made up of a shared library with embedded ZIP plus a pkgIndex.tcl,
  nothing more. 


* glob performance of the ZIP filesystem isn't great when lots of ZIP archive members
  from one or more mounts fill up the single hash table (ZipFS.fileHash) since the
  glob involves linear scanning through the entire table. For common glob usage
  patterns added hash tables in ZIP directory entries for the children of the
  respective directory can give a significant speed up at the expense of more
  memory (a common design problem of all real world filesystems). The respective
  pieces can be found in

https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=221-251
https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=309-339
https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=1894-2242
https://www.androwish.org/home/file?ci=tip&name=jni/tcl/generic/zipfs.c&ln=5023-5263
Log in (anonymous is fine) to add a comment.