File: benchmark.vala

package info (click to toggle)
libxmlbird 1.2.15-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: python: 649; xml: 122; sh: 51; makefile: 14
file content (41 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

string get_string (int length) {
	StringBuilder s = new StringBuilder ();
	
	while (length-- > 0) {
		s.append ("a");
	}
	
	return s.str;
}

string generate_big_xml_file () {
	string name;
	StringBuilder xml = new StringBuilder ();
	
	for (int i = 0; i < 10000; i++) {
		name = get_string (20);
		xml.append ("<tag_with_long_name ");
		xml.append ("attribute");
		xml.append ("=\"");
		xml.append (get_string (i));
		xml.append ("\">");
		xml.append ("<data>");
		xml.append (get_string (i));
		xml.append ("</data>");
		xml.append ("</tag_with_long_name>");
	}
	
	return xml.str;
}


public static int main (string[] arg) {
	B.Test t;
	
	t = new B.Test (generate_big_xml_file ());
	t.benchmark ("Big file");
	
	return 0;
}