Fossil SCM
(experiment) Use d_type field of dirent structure for speedup.
Commit
0c7834c77b30469ab2587eeff9797b3ec8134fb4
Parent
1c39f113d13a767…
1 file changed
+20
+20
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -486,15 +486,25 @@ | ||
| 486 | 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | 487 | zPath = blob_str(pPath); |
| 488 | 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | 490 | /* do nothing */ |
| 491 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 492 | + }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1) | |
| 493 | + : (pEntry->d_type==DT_DIR) ){ | |
| 494 | +#else | |
| 491 | 495 | }else if( file_wd_isdir(zPath)==1 ){ |
| 496 | +#endif | |
| 492 | 497 | if( !vfile_top_of_checkout(zPath) ){ |
| 493 | 498 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 494 | 499 | } |
| 500 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 501 | + }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath)) | |
| 502 | + : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){ | |
| 503 | +#else | |
| 495 | 504 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 505 | +#endif | |
| 496 | 506 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 497 | 507 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 498 | 508 | db_step(&ins); |
| 499 | 509 | db_reset(&ins); |
| 500 | 510 | } |
| @@ -593,11 +603,16 @@ | ||
| 593 | 603 | zPath = blob_str(pPath); |
| 594 | 604 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 595 | 605 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 596 | 606 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 597 | 607 | /* do nothing */ |
| 608 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 609 | + }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1) | |
| 610 | + : (pEntry->d_type==DT_DIR) ){ | |
| 611 | +#else | |
| 598 | 612 | }else if( file_wd_isdir(zPath)==1 ){ |
| 613 | +#endif | |
| 599 | 614 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 600 | 615 | char *zSavePath = mprintf("%s", zPath); |
| 601 | 616 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 602 | 617 | pIgnore2, pIgnore3); |
| 603 | 618 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | ||
| 605 | 620 | db_step(&ins); |
| 606 | 621 | db_reset(&ins); |
| 607 | 622 | fossil_free(zSavePath); |
| 608 | 623 | result += count; /* found X normal files? */ |
| 609 | 624 | } |
| 625 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 626 | + }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath)) | |
| 627 | + : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){ | |
| 628 | +#else | |
| 610 | 629 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 630 | +#endif | |
| 611 | 631 | db_bind_text(&upd, ":file", zOrigPath); |
| 612 | 632 | db_step(&upd); |
| 613 | 633 | db_reset(&upd); |
| 614 | 634 | result++; /* found 1 normal file */ |
| 615 | 635 | } |
| 616 | 636 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -486,15 +486,25 @@ | |
| 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | zPath = blob_str(pPath); |
| 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | /* do nothing */ |
| 491 | }else if( file_wd_isdir(zPath)==1 ){ |
| 492 | if( !vfile_top_of_checkout(zPath) ){ |
| 493 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 494 | } |
| 495 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 496 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 497 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 498 | db_step(&ins); |
| 499 | db_reset(&ins); |
| 500 | } |
| @@ -593,11 +603,16 @@ | |
| 593 | zPath = blob_str(pPath); |
| 594 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 595 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 596 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 597 | /* do nothing */ |
| 598 | }else if( file_wd_isdir(zPath)==1 ){ |
| 599 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 600 | char *zSavePath = mprintf("%s", zPath); |
| 601 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 602 | pIgnore2, pIgnore3); |
| 603 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | |
| 605 | db_step(&ins); |
| 606 | db_reset(&ins); |
| 607 | fossil_free(zSavePath); |
| 608 | result += count; /* found X normal files? */ |
| 609 | } |
| 610 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 611 | db_bind_text(&upd, ":file", zOrigPath); |
| 612 | db_step(&upd); |
| 613 | db_reset(&upd); |
| 614 | result++; /* found 1 normal file */ |
| 615 | } |
| 616 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -486,15 +486,25 @@ | |
| 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | zPath = blob_str(pPath); |
| 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | /* do nothing */ |
| 491 | #ifdef _DIRENT_HAVE_D_TYPE |
| 492 | }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1) |
| 493 | : (pEntry->d_type==DT_DIR) ){ |
| 494 | #else |
| 495 | }else if( file_wd_isdir(zPath)==1 ){ |
| 496 | #endif |
| 497 | if( !vfile_top_of_checkout(zPath) ){ |
| 498 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 499 | } |
| 500 | #ifdef _DIRENT_HAVE_D_TYPE |
| 501 | }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath)) |
| 502 | : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){ |
| 503 | #else |
| 504 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 505 | #endif |
| 506 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 507 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 508 | db_step(&ins); |
| 509 | db_reset(&ins); |
| 510 | } |
| @@ -593,11 +603,16 @@ | |
| 603 | zPath = blob_str(pPath); |
| 604 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 605 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 606 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 607 | /* do nothing */ |
| 608 | #ifdef _DIRENT_HAVE_D_TYPE |
| 609 | }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isdir(zPath)==1) |
| 610 | : (pEntry->d_type==DT_DIR) ){ |
| 611 | #else |
| 612 | }else if( file_wd_isdir(zPath)==1 ){ |
| 613 | #endif |
| 614 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 615 | char *zSavePath = mprintf("%s", zPath); |
| 616 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 617 | pIgnore2, pIgnore3); |
| 618 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | |
| 620 | db_step(&ins); |
| 621 | db_reset(&ins); |
| 622 | fossil_free(zSavePath); |
| 623 | result += count; /* found X normal files? */ |
| 624 | } |
| 625 | #ifdef _DIRENT_HAVE_D_TYPE |
| 626 | }else if( (pEntry->d_type==DT_UNKNOWN) ? (file_wd_isfile_or_link(zPath)) |
| 627 | : (pEntry->d_type==DT_REG||pEntry->d_type==DT_LNK) ){ |
| 628 | #else |
| 629 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 630 | #endif |
| 631 | db_bind_text(&upd, ":file", zOrigPath); |
| 632 | db_step(&upd); |
| 633 | db_reset(&upd); |
| 634 | result++; /* found 1 normal file */ |
| 635 | } |
| 636 |