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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:46:06+00:00 2026-06-01T07:46:06+00:00

I received some multi-line data via HTTP and have it in one string. I

  • 0

I received some multi-line data via HTTP and have it in one string. I need to filter only lines containing specific keywords and write it to a file.

How do I process these individual lines without consuming excessive memory? I.e. without splitting the input string at newline and then processing the list?

Jython-specific solutions are welcome, too.

  • 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-06-01T07:46:08+00:00Added an answer on June 1, 2026 at 7:46 am

    I now actually tested the memory requirements of using data.split(‘\n’), re.finditer(‘.*?\n’, data) and StringIO.readline() in Jython. I was surprised to find out that split() didn’t increase used memory (PS Old Gen), StringIO came second and re third.

    Jython 2.5.1+:
      split()  +0 x data
      StringIO +2 x data
      re       +4 x data
    
    Jython 2.2.1:
      split()  +0 x data
      re       +2 x data
      StringIO +7 x data
    

    StringIO didn’t use additional memory after the .write() call, i.e. it seems to be backed by the same string in Jython.

    I didn’t test speed.

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

Sidebar

Related Questions

I received some compiled classes that I need to add to a project. One
I received some xml data that includes a timestamp taken at midnight of the
We have received some JavaScript from an agency that looks wrong, but works. For
I have a Person Class and based on some help I received in this
I have some code that uses a multi-part form and HTML5 file object to
I have some trouble with threading in my application. I have a multi-threaded client/server
I have my own multi-threaded service which handles some commands. The service consists of
I received some great help on joining a table to itself and am trying
Flawed as I am, I've received some unneeded help in creating errors in the
We're developing a pretty large application with MVC 2 RC2 and we've received some

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.