Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 293639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:17:38+00:00 2026-05-12T06:17:38+00:00

In my binary to text decoding application (.NET 2.0) I found that the line:

  • 0

In my binary to text decoding application (.NET 2.0) I found that the line:

logEntryTime.ToString("dd.MM.yy HH:mm:ss:fff")

takes 33% of total processing time. Does anyone have any ideas on how to make it faster?

EDIT: This app is used to process some binary logs and it currently takes 15 hours to run. So 1/3 of this will be 5 hours.

EDIT: I am using NProf for profiling. App is processing around 17 GBytes of binary logs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:17:39+00:00Added an answer on May 12, 2026 at 6:17 am

    It’s unfortunate that .NET doesn’t have a sort of "formatter" type which can parse a pattern and remember it.

    If you’re always using the same format, you might want to hand-craft a formatter to do exactly that. Something along the lines of:

    public static string FormatDateTime(DateTime dt)
    {
        // Note: there are more efficient approaches using Span<char> these days.
        char[] chars = new char[21];
        Write2Chars(chars, 0, dt.Day);
        chars[2] = '.';
        Write2Chars(chars, 3, dt.Month);
        chars[5] = '.';
        Write2Chars(chars, 6, dt.Year % 100);
        chars[8] = ' ';
        Write2Chars(chars, 9, dt.Hour);
        chars[11] = ' ';
        Write2Chars(chars, 12, dt.Minute);
        chars[14] = ' ';
        Write2Chars(chars, 15, dt.Second);
        chars[17] = ' ';
        Write2Chars(chars, 18, dt.Millisecond / 10);
        chars[20] = Digit(dt.Millisecond % 10);
        
        return new string(chars);
    }
    
    private static void Write2Chars(char[] chars, int offset, int value)
    {
        chars[offset] = Digit(value / 10);
        chars[offset+1] = Digit(value % 10);
    }
    
    private static char Digit(int value)
    {
        return (char) (value + '0');
    }
    

    This is pretty ugly, but it’s probably a lot more efficient… benchmark it, of course!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 143k
  • Answers 143k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Currently, no. It's been an open request for four years.… May 12, 2026 at 8:29 am
  • Editorial Team
    Editorial Team added an answer In visual studio, help about shows the visual studio version.… May 12, 2026 at 8:29 am
  • Editorial Team
    Editorial Team added an answer Yes. Your web pages aren't just consumed by people: they're… May 12, 2026 at 8:29 am

Related Questions

I wish to store URLs in a database (MySQL in this case) and process
On Linux (or Solaris) is there a better way than hand parsing /proc/self/maps repeatedly
Why are flat text files the state of the art for representing source code?
I am using the standard .NET OdbcConnection to connect to an AS/400 iSeries database.
I’m writing text to a binary file in C# and see a difference in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.