- 05 Aug, 2018 7 commits
-
-
Kenton Varda authored
-
Kenton Varda authored
Hash-based (unordered) and tree-based (ordered) indexing are provided. kj::Table offers advantages over STL: - A Table can have multiple indexes (allowing lookup by multiple keys). Different indexes can use different algorithms (e.g. hash vs. tree) and have different uniqueness constraints. - The properties on which a Table is indexed need not be explicit fields -- they can be computed from the table's row type. - Tables use less memory and make fewer allocations than STL, because rows are stored in a contiguous array. - The hash indexing implementation uses linear probing rather than chaining, which again means far fewer allocations and more cache-friendliness. - The tree indexing implementation uses B-trees optimized for cache line size, whereas STL uses cache-unfriendly and allocation-heavy red-black binary trees. (However, STL trees are overall more cache-friendly; see below.) - Most of the b-tree implementation is not templated. This reduces code bloat, at the cost of some performance due to virtual calls. On an ad hoc benchmark on large tables, the hash index implementation appears to outperform libc++'s `std::unordered_set` by ~60%. However, libc++'s `std::set` still outperforms the B-tree index by ~70%. It looks like the B-tree implementation suffers in part from the fact that keys are not stored inline in the tree nodes, forcing extra memory indirections. This is a price we pay for lower memory usage overall, and the ability to have multiple indexes on one table. The b-tree implementation also suffers somewhat from not being 100% templates, compared to STL, but I think this is a reasonable trade-off. The most performance-critical use cases will use hash indexes anyway.
-
Kenton Varda authored
-
Kenton Varda authored
-
Kenton Varda authored
You need to use a different constructor function, `refTuple()`, to opt into references. Otherwise, it's too easy to construct a tuple of references by mistake.
-
Kenton Varda authored
indexOfType<T, Tuple<...>>() searches the Tuple for a member of type T and returns its index. It fails to compile if there is not exactly one match. TypeOfIndex<i, Tuple<...>> evaluates to the type of the Tuple member at the given index.
-
Kenton Varda authored
I'm tired of working around missing features that were added in C++14. It's four years old now, compilers should support it.
-
- 28 Jul, 2018 1 commit
-
-
Kenton Varda authored
Ignore ECHILD in UnixEventPort::ChildSet::checkExits
-
- 20 Jul, 2018 1 commit
-
-
Oliver Giles authored
If no child process has changed state, waitpid() returns zero. But if there are no more child processes at all, it returns -1 and sets errno to ECHILD. Since checkExits calls waitpid() in a loop, it must ignore ECHILD. +Unit test modified to exhibit the unexpected behaviour.
-
- 16 Jul, 2018 6 commits
-
-
Harris Hancock authored
cmake: drop NO_DEFAULT_PATHS when searching libraries
-
Kenton Varda authored
Add functions for async-signal-safe stringification
-
Kenton Varda authored
-
Kenton Varda authored
-
Kenton Varda authored
Alas, this means we can't use sprintf() anymore. Ugh.
-
Kenton Varda authored
Automatically reduce `Promise<RemotePromise<T>>` -> `RemotePromise<T>`.
-
- 15 Jul, 2018 3 commits
-
-
Kenton Varda authored
-
Kenton Varda authored
VS 2015 is just too buggy. Working around the bugs is wasting developer time. This change does not actually remove any of the hacks yet, so that we can undo this decision if there are significant complaints after the next release.
-
Kenton Varda authored
Just like `Promise<Promise<T>>` reduces to `Promise<T>`, we should be able to reduce `Promise<RemotePromise<T>>`. Moreover, this reduction should support pipelining, hence the reduced type should itself be `RemotePromise<T>`. Fixes #341
-
- 14 Jul, 2018 2 commits
-
-
Kenton Varda authored
This is safer for signal handlers.
-
Kenton Varda authored
This is useful especially in signal handlers where malloc() is potentially unsafe.
-
- 13 Jul, 2018 1 commit
-
-
Harris Hancock authored
An inconsistency was introduced with the previous fix to allow Cap'n Proto installations in system directories to be found by CapnProtoTargets.cmake: if the user installed Cap'n Proto in two locations, one of which is a system directory, e.g. /usr and /somewhere/else, and set PKG_CONFIG_PATH=/somewhere/else/lib/pkgconfig, the dependent project would use headers from /somewhere/else/include, but libraries from /usr/lib. This change resolves the inconsistency, allowing PKG_CONFIG_PATH to solely control the location of the desired installation of Cap'n Proto.
-
- 30 Jun, 2018 3 commits
-
-
Kenton Varda authored
fix const-correctness on AnyPointer equality checks
-
Nils Fenner authored
-
Nils Fenner authored
-
- 25 Jun, 2018 2 commits
-
-
Kenton Varda authored
Log unknown Transfer-Encoding values in kj-http
-
Harris Hancock authored
Printf debugging at its finest.
-
- 24 Jun, 2018 2 commits
-
-
Kenton Varda authored
Allow .cmd/.bat files as compiler plugins on Windows.
-
Kenton Varda authored
Fixes #487 Fixes #695
-
- 21 Jun, 2018 1 commit
-
-
Kenton Varda authored
Fix handling of disconnect during WebSocket::pumpTo().
-
- 20 Jun, 2018 1 commit
-
-
Kenton Varda authored
Before this change, if *either* the `from` or the `to` end of the pump threw a DISCONNECTED exception, we'd then try to call `to.disconnect()`. But if the exception had been thrown from `to` in the first place, then this would throw again, this time complaining about a previous write not having completed. But the whole point was always to propagate errors from the *receiving* end to the sending end. An error on the sending end should just propagate up the stack.
-
- 13 Jun, 2018 6 commits
-
-
Kenton Varda authored
Add GzipAsyncOutputStream::Decompress and ::flush
-
Ingvar Stepanyan authored
-
Ingvar Stepanyan authored
-
Ingvar Stepanyan authored
Move generic gzip output operations to private helper for easier sharing of capabilities between GzipOutputStream and GzipAsyncOutputStream.
-
Ingvar Stepanyan authored
- Makes it possible to decompress data granularly via push-based API. - Adds ability to flush output at an arbitrary point. - Removes manual `ended` check as zlib checks it for us.
-
Ingvar Stepanyan authored
Contents of kj-gzip are guarded by KJ_HAS_ZLIB, but the library itself should be still added unconditionally to non-CAPNP_LITE build for tests to link properly.
-
- 12 Jun, 2018 2 commits
-
-
Kenton Varda authored
Add limit to readAllBytes()/readAllText()
-
Harris Hancock authored
Reading an unbounded amount of data from a stream is a potential DoS vector. To manage this risk, readAllText() and readAllBytes() now accept a `limit` parameter. For source backwards-compatibility, this limit defaults to kj::maxValue.
-
- 11 Jun, 2018 2 commits
-
-
Kenton Varda authored
Fix a typo
-
Ian Denhardt authored
s/starp/strap/
-