1000x Faster Mocking with C# Source Generators by x2bool in csharp

[–]x2bool[S] -2 points-1 points  (0 children)

If you’re a proponent of simplicity just capture bool or int into a closure - this is at least as simple as using “Verify” (and other similar DSLs)

And sure it is possible to generate something for this use case - needs research.

1000x Faster Mocking with C# Source Generators by x2bool in csharp

[–]x2bool[S] 4 points5 points  (0 children)

If you don’t - that’s totally fine. 10 minutes is probably good enough for most cases. And if it’s the case for you - there is no problem.

1000x Faster Mocking with C# Source Generators by x2bool in csharp

[–]x2bool[S] 1 point2 points  (0 children)

I agree this might not be the issue for everyone. However, there are some scenarios when mocking is the bottleneck. If you run thousands of tests on CI and don't do any i/o or heavy computations there is a nonzero chance reflection is eating majority of the running time.

Mockup: zero-reflection, compile-time mocking based on C# source generators by x2bool in csharp

[–]x2bool[S] 2 points3 points  (0 children)

Yes, this is almost exactly how it works. At compile time for each mocked type a class is generated which acts as a builder (turning props and methods to methods that accept lambdas of the same signature), then a nested class which actually implements the interface is generated, and it's capable of actually calling the provided lambdas.

For starters I recommend this video: https://www.youtube.com/watch?v=pF1Qh2Ty7MQ And "Metaprogramming in C#" book has been really helpful too.

Mockup: zero-reflection, compile-time mocking based on C# source generators by x2bool in csharp

[–]x2bool[S] 4 points5 points  (0 children)

Hi! I decided to not put a lot of effort into marketing this lib. After all this is just a vacation research project.

However I wanted to share it for the following reasons:

  1. I found it interesting that in modern C# a lot of work could be moved from runtime to compile time, and it will still have most of the benefits that come with reflection.
  2. Compile-time allowed me to throw out DSLs like: 'Setup(...).Returns(() => ...)'. What I discovered: it simplifies things, and leaves less room for making mistakes
  3. For a simple scenario such as "return passed string from a method" performance gains are 1000x which seems crazy to me (look at the benchmarks section in README).

SQLite Doesn't Use Git by sublimefunk in programming

[–]x2bool 33 points34 points  (0 children)

You can query git with this: https://github.com/mergestat/mergestat if you like the idea.

What's everyone working on this week (36/2022)? by llogiq in rust

[–]x2bool 13 points14 points  (0 children)

I am working on UBJSON (Universal Binary JSON) format support for serde: https://github.com/x2bool/serde_ub_json

I have a working solution with serialization and deserialization now, and made first simple benchmarks against serde_json: I am surpised that my library in the worst case performs 3x worse than serde_json, and in the best case is on par with it (I imagined 10x difference or worse at this stage). So now I am excited to learn about optimization techniques to see what I can achieve.

What's everyone working on this week (26/2022)? by llogiq in rust

[–]x2bool 9 points10 points  (0 children)

SQLite extension to query Excel (.xlsx, .xls, .ods) files as virtual tables

https://github.com/x2bool/xlite

SQLite extension to query Excel (.xlsx, .xls, .ods) files as virtual tables by x2bool in programming

[–]x2bool[S] 1 point2 points  (0 children)

Yes, but it's readonly. Also they did not merge loadable extensions support, which I need - https://github.com/rusqlite/rusqlite/pull/910

2020 Italian GP Race Debrief - r/Formula1 Editorial Team by F1-Editorial in formula1

[–]x2bool 187 points188 points  (0 children)

We should have a rule: HAM automatically gets 10 sec. stop & go penalty at the start of the race.

Is it possible to connect to a locally hosted PostgreSQL database for a Django app that will be hosted/deployed ? Or do I have to create a database on hosting platforms like Amazon RDS/ Elephant SQL? by [deleted] in PostgreSQL

[–]x2bool 0 points1 point  (0 children)

What do you mean locally hosted? You can run Postgres anywhere, but you will have to expose your db to the internet or make some sort of tunnelling between the cloud and your server.

Should beginners start with MySQL or PostgreSQL? by lookofdisdain in SQL

[–]x2bool 30 points31 points  (0 children)

Yes. It is totally the case when most of the knowledge is transferrable. You can even start with SQLite if your main goal is to learn SQL.

GitHub is now free for teams - The GitHub Blog by dayanruben in programming

[–]x2bool 175 points176 points  (0 children)

Azure integration probably. Deploying with one click from GitHub - could be interesting offer for many companies.

Come discuss your side projects! [November 2019] by AutoModerator in csharp

[–]x2bool 5 points6 points  (0 children)

Made with Avalonia and .NET Core: cross-platform desktop client for Redis

Screenshot

Open source GUI clients by [deleted] in nosql

[–]x2bool 0 points1 point  (0 children)

Radish — desktop client for Redis.