11 Commits

Author SHA1 Message Date
Michael Muré
7f61b44eb9 move _rsrch/cidiface into an internal package
_rsrch/cidiface is an engineering experiment package to explore the right form for a CID. As such, it's not meant to be actually used, and could result in conflict if used.

To avoid accidentally importing it (or even getting suggestions to do so), this package is moved into an "internal" folder, hinting tooling that it's not meant for external consumption.
2024-09-27 09:13:31 +10:00
web3-bot
5b6a9dce73 run gofmt -s 2022-08-25 15:55:13 +10:00
Marcin Rataj
3f1777738f Add libp2p-key multicodec
Context: https://github.com/multiformats/multicodec/issues/130

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2019-05-28 01:40:54 +02:00
Eric Myhre
924534b811 Inspect memory layout of struct wrapping string.
It's also viable.  Options list expanded.  (And regretting my ordering of it now.  Wish I'd thought of this one and realized it's distinct earlier.)
2018-08-28 01:00:21 +02:00
Eric Myhre
2cf56e3813 Benchmarks of various Cid types as map keys.
And writeup on same.

tl;dr interfaces are not cheap if you're already at the scale where you
started caring about whether or not you have pointers.
2018-08-24 14:03:54 +02:00
Eric Myhre
5a6d4bdf06 More readme on the state of iface research. 2018-08-24 13:18:50 +02:00
Eric Myhre
fb8ecaccad Enumerate some more options in prose. 2018-08-24 12:37:52 +02:00
Eric Myhre
348b9201a6 Start a readme for this research project.
Right now this is mostly this is to document the behavior of interface-keyed
maps.  I suspect some of those caveats might be non-obvious to a lot of folks.
2018-08-24 12:24:34 +02:00
Eric Myhre
b4ab25ffda Discovered interesting case in map key checking.
Using interfaces as a map's key type can cause some things that were otherwise
compile-time checks to be pushed off into runtime checks instead.
This is a pretty major "caveat emptor" if you use interface-keyed maps.
2018-08-24 12:18:07 +02:00
Eric Myhre
c724ad0d22 cid impl via struct and via string together.
Added back in some of the parser methods.  (These were previously named "Cast"
and I think that's silly and wrong so I fixed it.)

Functions are named overly-literally with their type (e.g. ParseCidString and
ParseCidStruct rather than ParseCid or even just Parse) because for this
research package I don't want to bother with many sub-packages.  (Maybe I'll
regret this, but at the moment it seems simpler to hold back on sub-packages.)

Functions that produce Cids are literal with their return types, as well.
Part of the purpose of this research package is going to be to concretely
benchmark exactly how much performance overhead there is to using interfaces
(which will likely cause a lot of boxing and unboxing in practice) -- since we
want to explore where this boxing happens and how much it costs, it's important
that none of our basic implementation functions do the boxing!

The entire set of codec enums came along in this commit.  Ah well; they would
have eventually anyway, I guess.  But it's interesting to note the only thing
that dragged them along so far is the reference to 'DagProtobuf' when
constructing v0 CIDs; otherwise, this enum is quite unused here.
2018-08-24 12:00:31 +02:00
Eric Myhre
ff25e9673c Open research dir; want to explore cid impl perf.
It's been discussed in several issues and PRs already that we might want to
explore various ways of implementing CIDs for maximum performance and
ease-of-use because they show up extremely often.  Current CIDs are pointers,
which generally speaking means you can't get one without a malloc; and also,
they're not particularly well-suited for use in map keys.

This branch is to attempt to consolidate all the proposals so far -- and do so
in a single branch which can be checked out and contains all the proposals at
once, because this will make it easy to do benchmarks and compare all of the
various ways we could implement this in one place (and also easier for humans
to track what the latest of each proposal is, since they're all in one place).

To start with: a Cid implementation backed by a string; and matching interface.

(I'm also taking this opportunity to be as minimalistic as possible in what
I port over into these experimental new Cid implementations.  This might not
last; but as long as all this work is to be done, it's a more convenient time
than usual to see what can be stripped down and still get work done.)

More to come.
2018-08-24 10:53:52 +02:00