Autor Beitrag
Xabitire
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Do 31.01.08 11:25 
Hi Leute,

ich würde gerne eine große Menge an Zahlen, die in einem Array gespeichert sind, einfach untereinander auflisten. Dabei kann es sich um bis zu 3000000 verschiedene Zahlen handeln.
Zuerst hatte ich die Zahlen in einer Listbox mit der Add-Funktion aufgelistet. Dauerte so lange, dass ich jedes mal frühzeitig abbrechen musste. Mittlerweile benutze ich ein Memo und füge die Zahlen auf folgende Art und Weise hinzu:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for i:= 1 to länge do
  begin
    aus:= aus + (IntToStr(Feld[i]))+ #13;     
  end;
Memo1.Lines.Text:= aus;


"aus" ist eine einfache Variable vom Typ String und der Rest, denke ich, erklärt sich von selbst.

Mit diser Methode brauche ich bei 3000000 Zahlen aber immer noch etwas mehr als 1 Minute. :gaehn:

Daher wollte ich mal fragen, welche Komponente würdet ihr mir empfehlen, und auf welche Art und Weise sollte ich die Zahlen ausgeben?

MFG Blackbird8690
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Do 31.01.08 11:33 
Hallo,

ListBox sollte schon gehen.

Probier mal:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
ListBox.Items.BeginUpdate;

Add...
Add...
Add...

ListBox.Items.EndUpdate;


r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
Xong
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 113

WIN 2000
Borland Developer Studio 2006
BeitragVerfasst: Do 31.01.08 11:40 
Wenn du wirklich nur die Zahlen anzeigen willst, dann nimm eine Paintbox und zeichne die Zahlen von Hand. Vergiss den Scrollbalken nicht... =)
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Do 31.01.08 11:47 
@hazard999: Ich Hab es mal gerade ausprobiert. Es dauert aber sogar doppelt so lang wie die von mir beschriebene Methode.

@Xong: muss ich mal noch ausprobieren.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 31.01.08 11:55 
Am besten nimm die TVirtualTreeView, da kannst du die Daten alle in dem Array lassen und musst die nur, wenn eine Zelle gezeichnet werden soll, angeben. Da so die visuelle Oberfläche nicht erst die ganzen Daten bekommen muss, ist das ganze extrem viel schneller.
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Do 31.01.08 11:57 
Mit der von Xong beschriebenen Methode komm ich auf ungefähr 5 Sekunden. Das ist ja schon mal nicht schlecht!

Kann man das Ganze vielleicht noch etwas besser umsetzen? Am liebsten wäre mir ja gar keine Zeitverzögerung!

Ansonsten erstmal THX!

MFG Blackbird8690
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 31.01.08 11:58 
Ja, mit der TVirtualTreeView sollten es nur Millisekunden sein. ;-)
Xong
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 113

WIN 2000
Borland Developer Studio 2006
BeitragVerfasst: Do 31.01.08 12:01 
Mit meiner Methode sollte es aber auch nicht länger als 25 ms dauern...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 31.01.08 12:05 
Ja, das stimmt, von der Zeit her sollte es ähnlich bzw. schneller sein, komfortabler ist die VirtualTreeView aber allemal, da gibts ja, wenn man das möchte, auch die Möglichkeiten, die ListView und TreeView bieten. Aber schon alleine, dass man sich nicht darum kümmern muss, welche Einträge gerade angezeigt werden, etc. ist schon viel wert.