Coder Social home page Coder Social logo

Comments (6)

jods4 avatar jods4 commented on August 19, 2024 1

Nothing is ever trivial 🤣
Turns out StartsWith(char) was not part of .net fx of good ole time, so I reverted.

Could have gone creative with str is ['@', ..], turns out that as optimal as it gets. Felt excessive, though 😏

from serilog-extensions-logging.

jods4 avatar jods4 commented on August 19, 2024

Another cheap win in .net < 9.0: StartsWith(char) is quite faster than StartsWith(string) on these two lines:
https://github.com/serilog/serilog-extensions-logging/blob/dev/src/Serilog.Extensions.Logging/Extensions/Logging/SerilogLogger.cs#L106-L111

In .net 9+ there's a fast path in StartsWith(string) that checks if (prefix.Length == 1) return str.StartsWith(prefix[0]).

from serilog-extensions-logging.

jods4 avatar jods4 commented on August 19, 2024

BTW: it would be nice to have similar fast logging when using Serilog natively!

from serilog-extensions-logging.

nblumhardt avatar nblumhardt commented on August 19, 2024

Thanks for all the thoughts and suggestions @jods4!

Anyone keen to investigate/PR any of these? 😎

from serilog-extensions-logging.

jods4 avatar jods4 commented on August 19, 2024

@nblumhardt The first changes are so trivial... here you go: #242

I should have opened a different issue for having performant code generator that works with Serilog.Log.
That's a whole lot more complicated, cannot be closed as quickly 😆

from serilog-extensions-logging.

nblumhardt avatar nblumhardt commented on August 19, 2024

Thanks again, keen to keep chipping away at these kinds of things, nice to see small gains add up over time :-)

from serilog-extensions-logging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.