Skip to content

yashrk/pvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A toy implementation of persistent vector for Guile Scheme

License

Project status

It's just a toy pet-project written for fun, with no commitment to improve or mantain it at all. The code is poorly tested, contains no important optimizations (e.g. shortcut to tail node, transients) and probably isn't production-ready.

Motivation

The absence of an efficient Clojure-like purelly functional vector in the Guile Scheme standard library and in the Guile ecosystem at all1 has always been a pain point for me. However, the idea of a bit-partitioned vector trie is very beautiful and relatively simple. So once I decided to implement it myself.

Documentation

See the manual and the documentation strings in pvector.scm.

Performance

Access to an element with random index

With linked list

Random reads, pvector vs. vector, vlist, vhash and linked list

Reads from a random index, average time in seconds (lesser is better), with various element count. Performance of persistent vector, scheme arrays (SRFI-43), vlists, vhashes, linked lists. Logarithmic scale on both axis. Vlist is slightly better than pvector, but it doesn't have a setter for the random index. Vector is imperative.

Without linked list

Random reads, pvector vs. vlist and vector

Reads from a random index, average time in seconds (lesser is better), with various element count. Performance of persistent vector, scheme arrays (SRFI-43), vlists, vhashes (linked lists are unacceptably slow with element count involved). Logarithmic scale on data size axis. Again, vlists can't update a random element in the middle of the data structure.

Change of an element at random index

Random writes, pvector vs. vhash and vector

Vhash is better than pvector, but see the data for random reads.

map and fold

map, pvector vs vector, vlist, list and vhash fold, pvector vs vector, vlist, list and vhash

Sources of inspiration

License

AGPL v3

Footnotes

Footnotes

  1. Of course, Lokke vector from the Lokke project and fectors should be mentioned; but I don't understand how to use Lokke vector outside of Lokke environment (and even is it possible at all or no), and the latter project looks abandoned more than decade ago.

About

Purelly functional vector (HAMT-based) for Guile Scheme

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors