Recent

Author Topic: Help with TStringlist duplicate names with different values  (Read 3127 times)

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Help with TStringlist duplicate names with different values
« Reply #15 on: November 21, 2019, 01:03:32 am »
This problem is a close cousin of the "sorting and counting" problem shown in a recent thread.

1.5 million names, if the name/value pairs are an average of 60 bytes, that would produce a file of about 93MB (CRLF terminated.)  Looking at the results obtained in the "sorting and counting" thread, a good algorithm should take care of the "problem" in about 5 seconds or less.  Significantly longer than that would indicate that the algorithm is probably a canine.

@OH1KH

Post a sample (short is fine, 1000 entries would do) of the file. 

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

avk

  • Hero Member
  • *****
  • Posts: 752
Re: Help with TStringlist duplicate names with different values
« Reply #16 on: November 21, 2019, 04:51:32 am »
@440bx, this seems to be the right point of view. But really, it would like to see a sample input.

PS. Just tested, loading into a hashmap the text file consisting of 1,500,000 lines of the form "somename=somevalue" takes about 1.5 - 2 seconds.
« Last Edit: November 21, 2019, 05:20:45 am by avk »

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Help with TStringlist duplicate names with different values
« Reply #17 on: November 21, 2019, 05:32:48 am »
@avk
...would like to see a sample input.
Agreed.  Without seeing what the input is, any conclusion based only on the description is somewhat speculative.

PS. Just tested, loading into a hashmap the text file consisting of 1,500,000 lines of the form "somename=somevalue" takes about 1.5 - 2 seconds.
That sounds like the right ballpark. :)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018