ADDED gc_lang/fr/modules/perf.txt Index: gc_lang/fr/modules/perf.txt ================================================================== --- gc_lang/fr/modules/perf.txt +++ gc_lang/fr/modules/perf.txt cannot compute difference between binary files Index: gc_lang/fr/modules/tests.py ================================================================== --- gc_lang/fr/modules/tests.py +++ gc_lang/fr/modules/tests.py @@ -201,28 +201,31 @@ try: yield finally: end = time.perf_counter() print('{} : {}'.format(label, end - start)) - hDst.write("{:<12.6}".format(end-start)) + if hDst: + hDst.write("{:<12.6}".format(end-start)) -def perf (sVersion): +def perf (sVersion, hDst=None): print("\nPerformance tests") gce.load() aErrs = gce.parse("Texte sans importance… utile pour la compilation des règles avant le calcul des perfs.") - with open("./tests/fr/perf.txt", "r", encoding="utf-8") as hSrc, \ - open("./tests/fr/perf_memo.txt", "a", encoding="utf-8", newline="\n") as hDst: - hDst.write("{:<12}{:<20}".format(sVersion, time.strftime("%Y.%m.%d %H:%M"))) + spHere, spfThisFile = os.path.split(__file__) + with open(os.path.join(spHere, "perf.txt"), "r", encoding="utf-8") as hSrc: + if hDst: + hDst.write("{:<12}{:<20}".format(sVersion, time.strftime("%Y.%m.%d %H:%M"))) for sText in ( s.strip() for s in hSrc if not s.startswith("#") and s.strip() ): with timeblock(sText[:sText.find(".")], hDst): aErrs = gce.parse(sText) - hDst.write("\n") + if hDst: + hDst.write("\n") def main(): unittest.main() if __name__ == '__main__': main() ADDED gc_lang/fr/perf_memo.txt Index: gc_lang/fr/perf_memo.txt ================================================================== --- gc_lang/fr/perf_memo.txt +++ gc_lang/fr/perf_memo.txt @@ -0,0 +1,24 @@ +# MEMO OF PERFORMANCES +# Shorter is better + + 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. +0.4.10.2 4.7797 1.1617 0.8074 0.2343 0.2647 0.2749 0.6367 0.3463 +0.5.0a 2015.08.28 4.6203 1.0860 0.7567 0.2213 0.2518 0.2635 0.6089 0.3315 +0.5.0b 2015.09.21 4.2869 1.0140 0.6941 0.2061 0.2312 0.2471 0.5667 0.3124 +0.5.0b 2015.09.21 17:42 4.307 1.016 0.6984 0.2066 0.2353 0.2479 0.5715 0.3157 0.05686 0.007637 +0.5.0b 2015.09.23 22:54 4.47859 1.05899 0.732804 0.214195 0.243011 0.259232 0.598795 0.329411 0.0574977 0.00810443 +0.5.0b3 2015.10.11 09:23 4.56807 1.07108 0.745156 0.21713 0.246066 0.263882 0.605003 0.331472 0.0585957 0.00798071 +0.5.0b4 2015.10.25 10:36 4.68602 1.1036 0.816759 0.236306 0.263662 0.277191 0.632331 0.355515 0.059987 0.00801248 (py3.4) +0.5.0b4 2015.10.25 10:57 4.21442 0.991038 0.739702 0.212349 0.239072 0.251278 0.575609 0.318801 0.0531821 0.00738796 (py3.5) +0.5.0b6 2016.02.25 22:01 4.67677 1.09785 0.794943 0.225662 0.261311 0.274515 0.633468 0.347967 0.0592074 0.00853299 +0.5.0b6 2016.03.03 11:22 4.60471 1.06554 0.774112 0.218736 0.252905 0.263989 0.610623 0.334882 0.0567706 0.00786996 +0.5.0b8 2016.04.28 16:46 4.46168 1.07131 0.766851 0.215897 0.24811 0.252945 0.586484 0.318905 0.0538788 0.00748515 +0.5.5 2016.05.19 17:57 4.48851 1.06935 0.766362 0.218503 0.250422 0.260964 0.604672 0.333179 0.0563006 0.00855781 +0.5.7 2016.06.01 18:08 4.3773 1.04008 0.749191 0.2141 0.236444 0.245076 0.564722 0.307174 0.0540038 0.00705854 (option groups) +0.5.11 2016.10.09 16:14 4.53121 1.08698 0.760695 0.220858 0.242361 0.255862 0.606328 0.334436 0.0573431 0.00760688 +0.5.12 2016.10.14 18:58 4.51895 1.0843 0.772805 0.22387 0.249411 0.261593 0.628802 0.339303 0.0570326 0.00805416 +0.5.15 2017.01.22 11:44 4.85204 1.16134 0.770762 0.227874 0.244574 0.253305 0.58831 0.319987 0.0603996 0.00694786 +0.5.15 2017.01.22 11:47 4.85593 1.15248 0.762924 0.22744 0.243461 0.254609 0.586741 0.317503 0.0588827 0.00701016 (unicode normalisation NFC) +0.5.15 2017.01.31 12:06 4.88227 1.18008 0.782217 0.232617 0.247672 0.257628 0.596903 0.32169 0.0603505 0.00695196 +0.5.15 2017.02.05 10:10 4.90222 1.18444 0.786696 0.233413 0.25071 0.260214 0.602112 0.325235 0.0609932 0.00706897 +0.5.16 2017.05.12 07:41 4.92201 1.19269 0.80639 0.239147 0.257518 0.266523 0.62111 0.33359 0.0634668 0.00757178 Index: make.py ================================================================== --- make.py +++ make.py @@ -434,10 +434,11 @@ xParser.add_argument("lang", type=str, nargs='+', help="lang project to generate (name of folder in /lang)") xParser.add_argument("-b", "--build_data", help="launch build_data.py", action="store_true") xParser.add_argument("-d", "--dict", help="generate FSA dictionary", action="store_true") xParser.add_argument("-t", "--tests", help="run unit tests", action="store_true") xParser.add_argument("-p", "--perf", help="run performance tests", action="store_true") + xParser.add_argument("-pm", "--perf_memo", help="run performance tests and store results in perf_memo.txt", action="store_true") xParser.add_argument("-js", "--javascript", help="JavaScript build for Firefox", action="store_true") xParser.add_argument("-fx", "--firefox", help="Launch Firefox Nightly for XPI testing", action="store_true") xParser.add_argument("-tb", "--thunderbird", help="Launch Thunderbird", action="store_true") xParser.add_argument("-i", "--install", help="install the extension in Writer (path of unopkg must be set in config.ini)", action="store_true") xArgs = xParser.parse_args() @@ -485,11 +486,11 @@ # make sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, ) # tests - if xArgs.tests or xArgs.perf: + if xArgs.tests or xArgs.perf or xArgs.perf_memo: print("> Running tests") try: tests = importlib.import_module("grammalecte."+sLang+".tests") print(tests.__file__) except ImportError: @@ -496,12 +497,13 @@ print("# Error. Couldn't import file {}_test.py in folder tests".format(sLang)) else: if xArgs.tests: xTestSuite = unittest.TestLoader().loadTestsFromModule(tests) unittest.TextTestRunner().run(xTestSuite) - if xArgs.perf: - tests.perf(sVersion) + if xArgs.perf or xArgs.perf_memo: + hDst = open("./gc_lang/"+sLang+"/perf_memo.txt", "a", encoding="utf-8", newline="\n") if xArgs.perf_memo else None + tests.perf(sVersion, hDst) # Firefox if xArgs.firefox: with cd("_build/xpi/"+sLang): os.system("jpm run -b nightly") DELETED tests/fr/perf.txt Index: tests/fr/perf.txt ================================================================== --- tests/fr/perf.txt +++ tests/fr/perf.txt cannot compute difference between binary files DELETED tests/fr/perf_memo.txt Index: tests/fr/perf_memo.txt ================================================================== --- tests/fr/perf_memo.txt +++ tests/fr/perf_memo.txt @@ -1,23 +0,0 @@ -# MEMO OF PERFORMANCES -# Shorter is better - - 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. -0.4.10.2 4.7797 1.1617 0.8074 0.2343 0.2647 0.2749 0.6367 0.3463 -0.5.0a 2015.08.28 4.6203 1.0860 0.7567 0.2213 0.2518 0.2635 0.6089 0.3315 -0.5.0b 2015.09.21 4.2869 1.0140 0.6941 0.2061 0.2312 0.2471 0.5667 0.3124 -0.5.0b 2015.09.21 17:42 4.307 1.016 0.6984 0.2066 0.2353 0.2479 0.5715 0.3157 0.05686 0.007637 -0.5.0b 2015.09.23 22:54 4.47859 1.05899 0.732804 0.214195 0.243011 0.259232 0.598795 0.329411 0.0574977 0.00810443 -0.5.0b3 2015.10.11 09:23 4.56807 1.07108 0.745156 0.21713 0.246066 0.263882 0.605003 0.331472 0.0585957 0.00798071 -0.5.0b4 2015.10.25 10:36 4.68602 1.1036 0.816759 0.236306 0.263662 0.277191 0.632331 0.355515 0.059987 0.00801248 (py3.4) -0.5.0b4 2015.10.25 10:57 4.21442 0.991038 0.739702 0.212349 0.239072 0.251278 0.575609 0.318801 0.0531821 0.00738796 (py3.5) -0.5.0b6 2016.02.25 22:01 4.67677 1.09785 0.794943 0.225662 0.261311 0.274515 0.633468 0.347967 0.0592074 0.00853299 -0.5.0b6 2016.03.03 11:22 4.60471 1.06554 0.774112 0.218736 0.252905 0.263989 0.610623 0.334882 0.0567706 0.00786996 -0.5.0b8 2016.04.28 16:46 4.46168 1.07131 0.766851 0.215897 0.24811 0.252945 0.586484 0.318905 0.0538788 0.00748515 -0.5.5 2016.05.19 17:57 4.48851 1.06935 0.766362 0.218503 0.250422 0.260964 0.604672 0.333179 0.0563006 0.00855781 -0.5.7 2016.06.01 18:08 4.3773 1.04008 0.749191 0.2141 0.236444 0.245076 0.564722 0.307174 0.0540038 0.00705854 (option groups) -0.5.11 2016.10.09 16:14 4.53121 1.08698 0.760695 0.220858 0.242361 0.255862 0.606328 0.334436 0.0573431 0.00760688 -0.5.12 2016.10.14 18:58 4.51895 1.0843 0.772805 0.22387 0.249411 0.261593 0.628802 0.339303 0.0570326 0.00805416 -0.5.15 2017.01.22 11:44 4.85204 1.16134 0.770762 0.227874 0.244574 0.253305 0.58831 0.319987 0.0603996 0.00694786 -0.5.15 2017.01.22 11:47 4.85593 1.15248 0.762924 0.22744 0.243461 0.254609 0.586741 0.317503 0.0588827 0.00701016 (unicode normalisation NFC) -0.5.15 2017.01.31 12:06 4.88227 1.18008 0.782217 0.232617 0.247672 0.257628 0.596903 0.32169 0.0603505 0.00695196 -0.5.15 2017.02.05 10:10 4.90222 1.18444 0.786696 0.233413 0.25071 0.260214 0.602112 0.325235 0.0609932 0.00706897