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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:39:59+00:00 2026-06-04T03:39:59+00:00

I have a method that reads from values from a file (reading method) and

  • 0

I have a method that reads from values from a file (reading method) and call another method from a Data Access Object (DAO) class which store these values into DB (storing method). My question is: shall i pass all the values read in the reading method as a list to the storing method ( which saves hundreds of method calls, but introduce the need for creation of the list in the reading method iteration over the list in the storing method), or shall i make a separate call to the storing method for each value ( which means hundreds of method calls, but without the need for list creation and iteration). which approach is more efficient from a performance and good practice view of point?

  • 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-04T03:40:01+00:00Added an answer on June 4, 2026 at 3:40 am

    You have multiple values, so someone has to iterate over the values. The only question is: who?

    Generally speaking: As soon as you talk about DB access (reading and writing) the overhead of allocating a list, iterating over it and doing some method calls is negligible to the overhead of one DB call (we talk about hundreds of call, not billions, right?). A DB call is in most cases something like a remote procedure call and writing to a database will write to disk – another great performance sucker.

    So in most cases you gain performance if you minimize the calls to the DB. And that can be done more easily if you DB access layer knows the complete job. So if you give the DAO a list it can do stuff like prepared statement, batch updates and what not. Given only bits and pieces those things are impossible to do with good performance.

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

Sidebar

Related Questions

I have a method that reads data from a comma separated text file and
I have a ConfigParameter SLSB that reads configuration values from the ejb-jar.xml file. This
I have a project that reads some data from xml file Convert.ToDouble metod works
I have a webservice method that reads a photo and returns its byte data.
I have one method that opens a file and passes off to another function
I have a class that reads a configuration file once and puts all the
I have a method that takes a list of entities ( Class es) and
Scenario: I am parsing values from an XML file using C# and have the
I have a project that reads in a file based on a value in
In Java, I have a method public int getNextFrame( byte[] buff ) that reads

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.