Bonjour ,

comment je peux diminuer le temps d’exécution de ce programme sachant que le tableau tab_voyelle contient 2669433 éléments:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
for elem in tab_voyelle:
	print 'la longueur est : ==>'
	print len(tab_voyelle)
	words_match = []
	elem = elem.strip()
	test = 0
	Tab_elem_out = CheckImpli(elem,tab_voyelle)
	if len(Tab_elem_out) != 0:
		MonFichINImpli = open('in_imply_result.txt','w')
		for i in range(len(Tab_elem_out)):
			MonFichINImpli.write(elem + '	' + Tab_elem_out[i] + '\n')
		MonFichINImpli.close()
		subprocess.call(['java', '-jar', 'ImpliMorphVer4.jar','-i', 'in_imply_result.txt','-o','Result_Impli.txt'])
		words_match = MatchingArabicWords('Result_Impli.txt','in_imply_result.txt')
	if len(words_match) != 0 :
		MonFichierResultat.write('<mot id="'+elem+'">'+'\n')
		for valeur in words_match:
			valeur = valeur.strip()
			MonFichierResultat.write('<val>'+valeur+'</val>'+'\n')
			t = tab_voyelle[tab_voyelle.index(valeur)]
			print t.decode('utf-8')
			del tab_voyelle[tab_voyelle.index(valeur)]
		MonFichierResultat.write('</mot>' + '\n')
 
	if len(words_match) == 0:
		MonFichierResultat.write('<mot id="'+elem+'">'+'\n'+'<val></val>\n'+'</mot>' + '\n')
MonFichierResultat.write('</matching>' + '\n')
MonFichierResultat.close()