freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][master] [ftbench] Set up cache earlier.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [ftbench] Set up cache earlier.
Date: Sat, 13 May 2023 22:32:10 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

  • 9b8fe44e
    by Alexei Podtelezhnikov at 2023-05-13T18:24:21-04:00
    [ftbench] Set up cache earlier.
    
    * src/ftbench.c (main): Run `FTC_Manager_New` and `FTC_*Cache_New`
    earlier and decide the test availability accordingly.
    (test_*_cache,benchmark): Do not check if cache is set.
    

1 changed file:

Changes:

  • src/ftbench.c
    ... ... @@ -268,13 +268,6 @@
    268 268
     
    
    269 269
         if ( test->cache_first )
    
    270 270
         {
    
    271
    -      if ( !cache_man )
    
    272
    -      {
    
    273
    -        printf( "  %-25s no cache manager\n", test->title );
    
    274
    -
    
    275
    -        return;
    
    276
    -      }
    
    277
    -
    
    278 271
           TIMER_RESET( &timer );
    
    279 272
           test->bench( &timer, face, test->user_data );
    
    280 273
         }
    
    ... ... @@ -587,12 +580,6 @@
    587 580
         FT_UNUSED( face );
    
    588 581
     
    
    589 582
     
    
    590
    -    if ( !cmap_cache )
    
    591
    -    {
    
    592
    -      if ( FTC_CMapCache_New( cache_man, &cmap_cache ) )
    
    593
    -        return 0;
    
    594
    -    }
    
    595
    -
    
    596 583
         TIMER_START( timer );
    
    597 584
     
    
    598 585
         for ( i = 0; i < charset->size; i++ )
    
    ... ... @@ -623,12 +610,6 @@
    623 610
         FT_UNUSED( user_data );
    
    624 611
     
    
    625 612
     
    
    626
    -    if ( !image_cache )
    
    627
    -    {
    
    628
    -      if ( FTC_ImageCache_New( cache_man, &image_cache ) )
    
    629
    -        return 0;
    
    630
    -    }
    
    631
    -
    
    632 613
         TIMER_START( timer );
    
    633 614
     
    
    634 615
         FOREACH( i )
    
    ... ... @@ -660,12 +641,6 @@
    660 641
         FT_UNUSED( user_data );
    
    661 642
     
    
    662 643
     
    
    663
    -    if ( !sbit_cache )
    
    664
    -    {
    
    665
    -      if ( FTC_SBitCache_New( cache_man, &sbit_cache ) )
    
    666
    -        return 0;
    
    667
    -    }
    
    668
    -
    
    669 644
         TIMER_START( timer );
    
    670 645
     
    
    671 646
         FOREACH( i )
    
    ... ... @@ -1060,7 +1035,6 @@
    1060 1035
         unsigned int   size           = FACE_SIZE;
    
    1061 1036
         int            max_iter       = 0;
    
    1062 1037
         double         max_time       = BENCH_TIME;
    
    1063
    -    int            compare_cached = 0;
    
    1064 1038
         int            j;
    
    1065 1039
     
    
    1066 1040
         unsigned int  versions[2] = { TT_INTERPRETER_VERSION_35,
    
    ... ... @@ -1144,7 +1118,11 @@
    1144 1118
             break;
    
    1145 1119
     
    
    1146 1120
           case 'C':
    
    1147
    -        compare_cached = 1;
    
    1121
    +        FTC_Manager_New( lib,
    
    1122
    +                         0, 0, max_bytes,
    
    1123
    +                         face_requester,
    
    1124
    +                         NULL,
    
    1125
    +                         &cache_man );
    
    1148 1126
             break;
    
    1149 1127
     
    
    1150 1128
           case 'c':
    
    ... ... @@ -1358,19 +1336,13 @@
    1358 1336
           }
    
    1359 1337
         }
    
    1360 1338
     
    
    1361
    -    if ( FTC_Manager_New( lib,
    
    1362
    -                          0,
    
    1363
    -                          0,
    
    1364
    -                          max_bytes,
    
    1365
    -                          face_requester,
    
    1366
    -                          NULL,
    
    1367
    -                          &cache_man ) )
    
    1368
    -      compare_cached = 0;
    
    1369
    -
    
    1370
    -    font_type.face_id = (FTC_FaceID)1;
    
    1371
    -    font_type.width   = size;
    
    1372
    -    font_type.height  = size;
    
    1373
    -    font_type.flags   = load_flags;
    
    1339
    +    if ( cache_man )
    
    1340
    +    {
    
    1341
    +      font_type.face_id = (FTC_FaceID)1;
    
    1342
    +      font_type.width   = size;
    
    1343
    +      font_type.height  = size;
    
    1344
    +      font_type.flags   = load_flags;
    
    1345
    +    }
    
    1374 1346
     
    
    1375 1347
         printf( "\n"
    
    1376 1348
                 "font preloading into memory: %s\n"
    
    ... ... @@ -1411,20 +1383,26 @@
    1411 1383
             test.bench = test_load;
    
    1412 1384
             benchmark( face, &test, max_iter, max_time );
    
    1413 1385
     
    
    1414
    -        if ( compare_cached )
    
    1386
    +        if ( cache_man )
    
    1415 1387
             {
    
    1416 1388
               test.cache_first = 1;
    
    1417 1389
     
    
    1418
    -          test.title = "Load (image cached)";
    
    1419
    -          test.bench = test_image_cache;
    
    1420
    -          benchmark( face, &test, max_iter, max_time );
    
    1421
    -
    
    1422
    -          test.title = "Load (sbit cached)";
    
    1423
    -          test.bench = test_sbit_cache;
    
    1424
    -          if ( size )
    
    1390
    +          if ( !FTC_ImageCache_New( cache_man, &image_cache ) )
    
    1391
    +          {
    
    1392
    +            test.title = "Load (image cached)";
    
    1393
    +            test.bench = test_image_cache;
    
    1425 1394
                 benchmark( face, &test, max_iter, max_time );
    
    1426
    -          else
    
    1427
    -            printf( "  %-25s disabled (size = 0)\n", test.title );
    
    1395
    +          }
    
    1396
    +
    
    1397
    +          if ( !FTC_SBitCache_New( cache_man, &sbit_cache ) )
    
    1398
    +          {
    
    1399
    +            test.title = "Load (sbit cached)";
    
    1400
    +            test.bench = test_sbit_cache;
    
    1401
    +            if ( size )
    
    1402
    +              benchmark( face, &test, max_iter, max_time );
    
    1403
    +            else
    
    1404
    +              printf( "  %-25s disabled (size = 0)\n", test.title );
    
    1405
    +          }
    
    1428 1406
             }
    
    1429 1407
             break;
    
    1430 1408
     
    
    ... ... @@ -1475,7 +1453,7 @@
    1475 1453
               FT_Matrix  rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 };
    
    1476 1454
     
    
    1477 1455
     
    
    1478
    -          /* rotate outlines by 30 degrees so that CBox and BBox are different */
    
    1456
    +          /* rotate outlines by 30 degrees so that CBox and BBox differ */
    
    1479 1457
               FT_Set_Transform( face, &rot30, NULL );
    
    1480 1458
               benchmark( face, &test, max_iter, max_time );
    
    1481 1459
               FT_Set_Transform( face, NULL, NULL );
    
    ... ... @@ -1498,7 +1476,8 @@
    1498 1476
     
    
    1499 1477
                 benchmark( face, &test, max_iter, max_time );
    
    1500 1478
     
    
    1501
    -            if ( compare_cached )
    
    1479
    +            if ( cache_man                                    &&
    
    1480
    +                 !FTC_CMapCache_New( cache_man, &cmap_cache ) )
    
    1502 1481
                 {
    
    1503 1482
                   test.cache_first = 1;
    
    1504 1483
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]