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 4240046
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:06:51+00:00 2026-05-21T03:06:51+00:00

For my usecase of Protocol Buffers, I need to serialize 4 integers(at max.) inside

  • 0

For my usecase of Protocol Buffers, I need to serialize 4 integers(at max.) inside each protocol buffer message. I want that when I retrieve those 4 integers from message, I get them as intand not as Integer. (The reason for this being I need some really fast calculations and equality checking(with some other int) on those retrieved integers)

If I use the repeated type in the PB message, then on parsing from the bytes, I get the list of Integer. Thus I planning to use 4 different variable(each int32 with optional tag) inside each PB message instead of using repeated. Thus I expect to get the integers as int and not as Integers

Is this a good idea & Will this help me ?

  • 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-21T03:06:52+00:00Added an answer on May 21, 2026 at 3:06 am

    It will certainly avoid the “list” issue. In regular .proto the size will be the same as long as the field numbers are small – the only difference on the wire will be different field numbers instead of the same number 4 times. However, if your list is currently using the “packed” option it will be marginally larger as 4 fields.

    Personally, since the size is capped at 4, I think the 4 field approach represents your scenario more closely, as otherwise there is nothing to stop you adding 20 values. I’m all for the 4 field approach here.

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

Sidebar

Related Questions

I was under the impression that I only need to specify the protocol when
I have such usecase: In my application some instances need to fire event, that
UseCase: Assume that rating of object is from 1 to 5 stars. It is
I have a usecase where I want to set the value of a field
I'm working now on a big system that consists of many subsystems , each
Here's one usecase that has been baffling me. When I select some text and
I want to create a dynamic Accordion, My usecase is like, On every click
Usecase: my hotline has phone number 0815/111222333 user starts up dialer and dials that
Usecase: The user makes font customizations to an object on the design surface, that
It seems I don't understand something simple about Protocol Buffers, but this is very

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.