Grammalecte  Check-in [dc74d19474]

Overview
Comment:[build] performance tests included in module
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: dc74d19474886a16ad2a78c81d48cb66478bbbab001d2f2e8e0245774a061948
User & Date: olr on 2017-05-12 05:43:21
Other Links: manifest | tags
Context
2017-05-12
13:02
[fr] avoir été + ppas check-in: b15bb95578 user: olr tags: trunk, fr
05:43
[build] performance tests included in module check-in: dc74d19474 user: olr tags: trunk, build
04:52
[fr] todo check-in: c7b2faa968 user: olr tags: trunk, fr
Changes

Name change from tests/fr/perf.txt to gc_lang/fr/modules/perf.txt.

cannot compute difference between binary files

Modified gc_lang/fr/modules/tests.py from [5fc75f3fc6] to [bf364f34cb].

199
200
201
202
203
204
205

206

207
208
209

210
211
212
213

214
215
216



217
218
219

220

221
222
223
224
225
226
227
228
199
200
201
202
203
204
205
206

207
208
209

210
211
212
213
214
215



216
217
218
219
220
221
222

223
224
225
226
227
228
229
230
231







+
-
+


-
+




+
-
-
-
+
+
+



+
-
+








def timeblock (label, hDst):
    start = time.perf_counter()
    try:
        yield
    finally:
        end = time.perf_counter()
        print('{} : {}'.format(label, end - start))
        if hDst:
        hDst.write("{:<12.6}".format(end-start))
            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.")

    spHere, spfThisFile = os.path.split(__file__)
    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")))
    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)
        if hDst:
        hDst.write("\n")
            hDst.write("\n")


def main():
    unittest.main()


if __name__ == '__main__':
    main()

Modified gc_lang/fr/perf_memo.txt from [94040e9e26] to [21922484a1].

17
18
19
20
21
22
23

17
18
19
20
21
22
23
24







+
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  

Modified make.py from [eeb66bd446] to [9e01013e33].

432
433
434
435
436
437
438

439
440
441
442
443
444
445
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446







+







    print("Python: " + sys.version)
    xParser = argparse.ArgumentParser()
    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()

    dir_util.mkpath("_build")
483
484
485
486
487
488
489
490

491
492
493
494
495
496
497
498
499
500
501
502



503
504
505
506
507
508
509
484
485
486
487
488
489
490

491
492
493
494
495
496
497
498
499
500
501


502
503
504
505
506
507
508
509
510
511







-
+










-
-
+
+
+







            if build_module:
                build_module.after('gc_lang/'+sLang, dVars, xArgs.javascript)

            # 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:
                    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")

            # Thunderbird