how to use a text file as a database

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 1746 Views - Last Post: 17 January 2013 - 09:57 AM Rate Topic: -----

#16 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

Re: how to use a text file as a database

Posted 17 January 2013 - 09:19 AM

I would think that because you have to access the list's index to assign it to the local variable in the first place, that it wouldn't be any faster.
Was This Post Helpful? 0
  • +
  • -

#17 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,467
  • Joined: 05-May 12

Re: how to use a text file as a database

Posted 17 January 2013 - 09:21 AM

Yeah, I was really dubious about the "5 times slower" comment. My thought of how that could be possible is that the IEnumerable implementation of the collection being iterated was really poorly written, and that each of the items being returned was an IDisposable.

This post has been edited by Skydiver: 17 January 2013 - 09:21 AM

Was This Post Helpful? 0
  • +
  • -

#18 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1182
  • View blog
  • Posts: 1,677
  • Joined: 24-August 11

Re: how to use a text file as a database

Posted 17 January 2013 - 09:41 AM

View PostCurtis Rutland, on 17 January 2013 - 10:19 AM, said:

I would think that because you have to access the list's index to assign it to the local variable in the first place, that it wouldn't be any faster.


Oh, yeah, good point. Maybe in situations where you access the item multiple times per iteration it might make a difference, albeit one several orders of magnitude smaller than we'd ever notice without asking the machine.
Was This Post Helpful? 0
  • +
  • -

#19 b0zhidar  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 21-December 12

Re: how to use a text file as a database

Posted 17 January 2013 - 09:57 AM

View Posteclipsed4utoo, on 17 January 2013 - 06:12 AM, said:

A for loop is not 5 times faster. That would mean that if a foreach loop took 10 seconds to process a loop, then a for loop would take 2 seconds. For the most part, the performance difference is negligible. The only time I choose for over foreach is when I need the index.


I see, that's why I said "As I am aware..", thanks for clearing that up, and thanks for the guy who posted the test.
That's a thing I believe I read somewhere on the NET.

Sorry for giving incorrect info,
Have a nice day guys.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2