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

  • Home
  • SEARCH
  • 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 7017281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:53:38+00:00 2026-05-27T22:53:38+00:00

So coming off of this question: Which is fast comparison: Convert.ToInt32(stringValue)==intValue or stringValue==intValue.ToString() I

  • 0

So coming off of this question:

Which is fast comparison: Convert.ToInt32(stringValue)==intValue or stringValue==intValue.ToString()

I am looking a base type for my networked application to be stored in packets.

The Idea:

  1. Packet class stores a list of (type)
  2. Add objects to the packet class
  3. Serialize and send it between machines
  4. Deserialize into (type)
  5. Convert (type) into the type of object you added originally.

Originally, I was using strings as (type). However, I am a bit dubious as every time I want to convert an int to a string, it seems like a tasking process. When I am communicating packets containing lots of uints to strings at 30FPS, I would like to make this process as fast as possible.

Therefore, I was wondering if byte[] would be a more suitable type. How fast is converting back and forth between a byte[] and ints/strings vs just strings to ints? BTW, I will not be sending a lot of strings on the network very often. Almost all of what I will be sending will be uints.

  • 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-27T22:53:39+00:00Added an answer on May 27, 2026 at 10:53 pm

    If you are using the same program on both ends, use BinarySerialization if possible. You are worried about speed; but unless this is just going between two processes on localhost, actual wire time, let alone latancy, will be orders of magnitude slower than any real conversion process.

    Of course, don’t concatenate strings; you will make a liar out of me.

    The thing you need to save here is your coding time, plus the possibility of errors for rolling your own serialization. If you properly encapsulate the data transfer parts of your program, upgrading them would be easy. Trying to spend extra time making something fast is called premature optimization (google it – it’s a valid argument – most of the time). If it is a bottleneck, leverage your encapsulated design, and change it. You won’t spend that much extra time then if you’d done it first – but likely won’t end up spending that time at all.

    A warning about binary serialization. The types you are sending must be the same version and type name. If you can put the same version into production on both ends, easily, it’s no worry. If you need more than this, or binaryserialization is too slow, look into FastJson, which makes big promises and is free, or something similar.

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

Sidebar

Related Questions

I have a abstract base class that I have many inherited classes coming off
This question is a spin-off/evolution of this question . (That question got marked as
I'm coming from a flash/flex background, so forgive me if this is an off
It seems that this question gets asked frequently , but I am not coming
I see this problem on and off again in my PHP coding, and I've
What's the best way of capturing an mp3 stream coming off of http and
Coming from C++ to Java, the obvious unanswered question is why didn't Java include
I'm recently working on this platform for which a legacy codebase issues a large
First off my background: I'm new to Java coming over from Ruby. If that
I'm writing this question from the standpoint of an ASP.NET application. However I realize

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.