Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#87

AW: Anzahl eines Zeichens im String ermitteln

  Alt 13. Jul 2018, 14:23
Ja, funktioniert jetzt. Allerdings ist das Zeitverhalten (mit Optimierung) noch schlechter als die Standardfunktion CountChar im StringHelper [...]
Dann scheint das aber stark systemabhängig zu sein. Bei mir sieht das so aus:

Zitat:
Benchmark: 1234588 miep(Data, 'X')
670 Nanoseconds wasted. (found X = 8031 times)

Benchmark: Ydobon Length(Data)-Length(StringReplace(Data, 'X', '', [rfReplaceAll]))
0 Nanoseconds wasted. (found X = 8031 times)

Benchmark: marabu Occurs(Data, 'X')
747 Nanoseconds wasted. (found X = 8031 times)

Benchmark: Missionar cCount(Data, 'X')
840 Nanoseconds wasted. (found X = 8031 times)

Benchmark: alzaimar IFCount(Data, 'X')
656 Nanoseconds wasted. (found X = 8031 times)

Benchmark: Uwe Raabe StringCountChar(Data, 'X')
654 Nanoseconds wasted. (found X = 8031 times)

Benchmark: KodeZwerg CountCharInString(Data, 'X')
248 Nanoseconds wasted. (found X = 8031 times)

Benchmark: KodeZwerg CharInStringA(Data, 'X')
593 Nanoseconds wasted. (found X = 8031 times)

Benchmark: Uwe Raabe CharCount(Data, 'X')
696 Nanoseconds wasted. (found X = 8031 times)

Benchmark: NeutralGeneral CharCount(Data, 'X')
532 Nanoseconds wasted. (found X = 8031 times)
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat