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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:29:46+00:00 2026-05-20T06:29:46+00:00

I face the common case of having to extract some information in a remote

  • 0

I face the common case of having to extract some information in a remote server via an HttpPost request. Imagine we are in the case of a weather app retrieving some weather info.

The server send a long inputstream and we are interested in extracting some information from this stream. Keep in mind we are in a memory-cpu bound environment.

We have two options:

1) We use a JSON or XML parser to extract the informations.

This is the recommended method, but it has some disadvantages:

  • It is painfully verbose, especially if we want little information from a big stream.

  • It should be faster and more garbage collection-friendly, but I’m not sure this is the case for the aforementioned case (little information from a big stream).

2) We use simple string manipulation (SSM):

We reduce the dimension of the inputstream by grossly trimming off useless infos, and then we extract the informations from a compact string. For this purpose, we can build filters using static methods, to reduce the work of the garbage collector.

Also this method has some disadvantages:

  • I think this method is strongly discouraged
  • The more informations we extract, the slower this method is. I think there is a critical point in the performance curve where SSM becomes slower.
  • It might be less flexible than JSON or other stock parser.

But also some important advantages:

  • Concise, human-readable code.
  • It might be difficult to modify an existing filter, but it is much easier to create a new one.

To sum up, the question is:

1) Is simple string manipulation a big no-no approach, or it is reasonable to consider its use?
2) If you answered yes (big no-no approach) to the previous question, could you explain your reason?

cheers 🙂

  • 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-20T06:29:47+00:00Added an answer on May 20, 2026 at 6:29 am

    I would request the information in JSON format (not XML which is more verbose with no advantage) and use an event-based parser to locate the data wanted by processing the stream in line as it’s read from the server.

    That will be very easy on memory, and require no change in what the server delivers. It will also be far more reliable and resistant to changes than any home-grown string slicing solution you might put together.

    I have a freely distributed very light-weight pull parser for JSON on my website. Others are available from http://www.json.org.

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

Sidebar

Related Questions

As the question says, what are some common/major issues that C++ programmers face when
I face some problems when I am trying to remove rows from a table
In face-configs.xml, <navigation-rule> <from-view-id>/login.jspx</from-view-id> <navigation-case> <from-outcome>failure</from-outcome> <to-view-id>/login.jspx?Error=InvalidUser</to-view-id> <redirect /> </navigation-case> </navigation-rule> When Login return
I face troubles accessing my website deployed on Websphere Application Server 6.0 when I
I face some layout differences in IE and in Chrome. I have searched Stack
Sometimes i face the following problem : string txt = con.Request.Params[Par_name].ToString();//the original par value
We face some issues with real time clock (RTC) batteries. These are usually old
I face a strange problem to access some HtmlGenericControl which created in run time
This is the most common problem I face while trying to learn programming in
I'm facing a common problem that novices face with Rails 3.2.3. I am getting

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.