Skip to content

Instantly share code, notes, and snippets.

View shawncao's full-sized avatar

Shawn Cao shawncao

View GitHub Profile
{
"extends": "./paths.json",
"compilerOptions": {
"target": "ES6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"downlevelIteration": true,
user.events.2days:
max-mb: 40000
max-hr: 48
schema: "ROW<__time:long,app:tinyint,country:string,gender:tinyint,age:tinyint,value:int>"
data: s3
loader: Swap
source: <path>
backup: s3://nebula/n303/
format: json
columns:
@shawncao
shawncao / gist:fa801d300c4a0a2826240fd9f5961db2
Created August 12, 2019 16:44
understand perf of std::optional
inline bool f1ni(int i) {
return i % 2 == 0;
}
TEST(OptionalTest, TestOptionalPerf) {
auto f2 = [](int i) -> std::optional<int> {
if (i % 2 == 0) {
return {};
}
return i + 1;
// Deserialize by pulling the
- static grpc::Status Deserialize(grpc_byte_buffer *buffer,
+ static grpc::Status Deserialize(ByteBuffer *bb,
flatbuffers::grpc::Message<T> *msg) {
- if (!buffer) {
+ grpc_byte_buffer* buffer = nullptr;
+ if (!bb || !(buffer = bb->c_buffer())) {
return ::grpc::Status(::grpc::StatusCode::INTERNAL, "No payload");
}
// Check if this is a single uncompressed slice.
@shawncao
shawncao / gist:abc91b05ce6167ace226ead2383f2302
Created July 23, 2019 14:44
expose byte_buffer in grpc
/// Is this ByteBuffer valid?
bool Valid() const { return (buffer_ != nullptr); }
+ grpc_byte_buffer* c_buffer() { return buffer_; }
private:
friend class SerializationTraits<ByteBuffer, void>;
friend class ServerInterface;
Context not available.
buffer_ = buf;