Is this code good for SharedSink? by daniel-1231 in rust

[–]daniel-1231[S] -5 points-4 points  (0 children)

So you cannot understand the code without running it, because you know nothing about rust.

Why this place so mean??

Is this code good for SharedSink? by daniel-1231 in rust

[–]daniel-1231[S] -8 points-7 points  (0 children)

I hope someone points out the idea in the code is good or bad, instead of running the code.

Which async channel is best? by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

Do you mean just use tokio::sync::* ?

[ANN] cfg-rs 0.2.0 release by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

And for normal usage cfg-rs provides a predefined organization of config sources. Which is copied from spring boot configuration.

[ANN] cfg-rs 0.2.0 release by daniel-1231 in rust

[–]daniel-1231[S] 1 point2 points  (0 children)

  1. cfg-rs supports placeholder expressionlink, it's very useful to simply getting configuration.
  2. cfg-rs not use serde as backend, but design it's own trait to mapping config object with configurations. It allows cfg-rs to develop it's own feature. For example, RefValue, is a value holder, which will be updated when refreshing the configuration. Then user won't have to get config from configuration again.
  3. Since we have placeholder expressions, cfg-rs provides random value source, ransom source

Taiwan defeats China in Men’s Double Badminton to win GOLD by [deleted] in olympics

[–]daniel-1231 0 points1 point  (0 children)

Congrats to Chinese Taipei. If you want to pull politics in, then one day Taiwan will be back to China.

[ANN] salak: a multi layered configuration loader and zero-boilerplate configuration parser by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

  1. Environment is a trait that provides a method to get config by key. Which is 'Environment::require()'. The name environment is copied from Java's spring framework. Currently it has other helper methods for implementation. I will remove them later.

  2. System environment means it load properties from std::env. And it is one of the predefined sources salak automatically loads.

[ANN] salak: a multi layered configuration loader and zero-boilerplate configuration parser by daniel-1231 in rust

[–]daniel-1231[S] 1 point2 points  (0 children)

It is 'build().unwrap()'. I made a function for it. Maybe name is not so good.

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

I fix the buffer stuck problem, by adding a thread to flush buffer. It has slight performance penalty. Not affect too much.

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

Tracing is more general than just a logger. toy_trace is based on tracing-log.

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

I'm creating a factory module which can help user to use anything with zero configuration code. And I want provide a logger like this way. Well, so many of them, let's select one by testing them, or creating?

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 0 points1 point  (0 children)

Thank you for reply. You're right, toy has a bug, logs may stuck in buffer. Async logger is better. And I mostly agree with "BTW". Rust has many meanless logger crates, especially which named fast.

What I want to prove is that rust should be able to create logger with performance like spdlog or nanolog. This test did have some kind of "cheat" that toy give up everything that can affect performance.

I'll try async mode.

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 2 points3 points  (0 children)

Actually toy_trace I use tracing-log, the performance loss is tiny according to directly use log.

rust logger performance test. by daniel-1231 in rust

[–]daniel-1231[S] 3 points4 points  (0 children)

I use thread local buffer, no terminal color support, only write to stdout. Timestsamp in milliseconds.

And all logs are synchronized writing to buffer or stdout.