summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xxdelta3/xdelta3-main.h69
-rwxr-xr-xxdelta3/xdelta3-regtest.py65
-rwxr-xr-xxdelta3/xdelta3-test.h2
-rwxr-xr-xxdelta3/xdelta3.c79
-rwxr-xr-xxdelta3/xdelta3.h28
5 files changed, 105 insertions, 138 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index d33ccd3..0a2592e 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -234,6 +234,9 @@ struct _main_blklru
234 main_blklru_list link; 234 main_blklru_list link;
235}; 235};
236 236
237#define LRU_SIZE 32U
238#define XD3_MINSRCWINSZ XD3_ALLOCSIZE
239
237/* ... represented as a list (no cache index). */ 240/* ... represented as a list (no cache index). */
238XD3_MAKELIST(main_blklru_list,main_blklru,link); 241XD3_MAKELIST(main_blklru_list,main_blklru,link);
239 242
@@ -402,7 +405,7 @@ main_malloc1 (usize_t size)
402{ 405{
403 void* r = malloc (size); 406 void* r = malloc (size);
404 if (r == NULL) { XPR(NT "malloc: %s\n", xd3_mainerror (ENOMEM)); } 407 if (r == NULL) { XPR(NT "malloc: %s\n", xd3_mainerror (ENOMEM)); }
405 else if (option_verbose > 2) { XPR(NT "malloc: %u: %p\n", size, r); } 408 else if (option_verbose > 3) { XPR(NT "malloc: %u: %p\n", size, r); }
406 return r; 409 return r;
407} 410}
408 411
@@ -425,7 +428,7 @@ main_alloc (void *opaque,
425static void 428static void
426main_free1 (void *opaque, void *ptr) 429main_free1 (void *opaque, void *ptr)
427{ 430{
428 if (option_verbose > 2) { XPR(NT "free: %p\n", ptr); } 431 if (option_verbose > 3) { XPR(NT "free: %p\n", ptr); }
429 free (ptr); 432 free (ptr);
430} 433}
431 434
@@ -589,16 +592,25 @@ main_strtoxoff (const char* s, xoff_t *xo, char which)
589} 592}
590 593
591static int 594static int
592main_atou (const char* arg, usize_t *xo, usize_t low, char which) 595main_atou (const char* arg, usize_t *xo, usize_t low, usize_t high, char which)
593{ 596{
594 xoff_t x; 597 xoff_t x;
595 int ret; 598 int ret;
596 599
597 if ((ret = main_strtoxoff (arg, & x, which))) { return ret; } 600 if ((ret = main_strtoxoff (arg, & x, which))) { return ret; }
598 601
599 if (x > USIZE_T_MAX || x < low) 602 if (x < low)
603 {
604 XPR(NT "-%c: minimum value: %u\n", which, low);
605 return EXIT_FAILURE;
606 }
607 if (high == 0)
608 {
609 high = USIZE_T_MAX;
610 }
611 if (x > high)
600 { 612 {
601 XPR(NT "-%c: minimum value: %u", which, low); 613 XPR(NT "-%c: maximum value: %u\n", which, high);
602 return EXIT_FAILURE; 614 return EXIT_FAILURE;
603 } 615 }
604 (*xo) = (usize_t)x; 616 (*xo) = (usize_t)x;
@@ -863,7 +875,7 @@ main_file_read (main_file *ifile,
863 } 875 }
864 else 876 else
865 { 877 {
866 if (option_verbose > 2) { XPR(NT "main read: %s: %u\n", ifile->filename, (*nread)); } 878 if (option_verbose > 3) { XPR(NT "main read: %s: %u\n", ifile->filename, (*nread)); }
867 ifile->nread += (*nread); 879 ifile->nread += (*nread);
868 } 880 }
869 881
@@ -903,7 +915,7 @@ main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
903 } 915 }
904 else 916 else
905 { 917 {
906 if (option_verbose > 2) { XPR(NT "main write: %s: %u\n", ofile->filename, size); } 918 if (option_verbose > 3) { XPR(NT "main write: %s: %u\n", ofile->filename, size); }
907 ofile->nwrite += size; 919 ofile->nwrite += size;
908 } 920 }
909 921
@@ -2035,16 +2047,16 @@ main_set_source (xd3_stream *stream, int cmd, main_file *sfile, xd3_source *sour
2035 else 2047 else
2036 { 2048 {
2037 /* Minimum size check */ 2049 /* Minimum size check */
2038 option_srcwinsz = max(option_srcwinsz, XD3_ALLOCSIZE); 2050 option_srcwinsz = max(option_srcwinsz, XD3_MINSRCWINSZ);
2039 2051
2040 if (!option_srcwinsz_set) 2052 if (!option_srcwinsz_set)
2041 { 2053 {
2042 /* If the flag was not set, scale srcwinsz up to 64MB. */ 2054 /* If the flag was not set, scale srcwinsz up to 64MB. */
2043 option_srcwinsz = min(1ULL<<26, source->size); 2055 option_srcwinsz = min((xoff_t) XD3_DEFAULT_SRCWINSZ, source->size);
2044 } 2056 }
2045 2057
2046 source->blksize = (option_srcwinsz / 32) & ~(XD3_ALLOCSIZE - 1);; 2058 source->blksize = (option_srcwinsz / LRU_SIZE);
2047 lru_size = 32; 2059 lru_size = LRU_SIZE;
2048 } 2060 }
2049 2061
2050 main_blklru_list_init (& lru_list); 2062 main_blklru_list_init (& lru_list);
@@ -2398,11 +2410,6 @@ main_input (xd3_cmd cmd,
2398 return EXIT_FAILURE; 2410 return EXIT_FAILURE;
2399 } 2411 }
2400 2412
2401 if (option_verbose > 1)
2402 {
2403 XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
2404 }
2405
2406 /* This times each window. */ 2413 /* This times each window. */
2407 get_millisecs_since (); 2414 get_millisecs_since ();
2408 2415
@@ -2637,6 +2644,24 @@ done:
2637 return EXIT_FAILURE; 2644 return EXIT_FAILURE;
2638 } 2645 }
2639 2646
2647 if (option_verbose > 1)
2648 {
2649 XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
2650 XPR(NT "target hash table size: %u\n", stream.small_hash.size);
2651 if (sfile->filename != NULL)
2652 {
2653 XPR(NT "source hash table size: %u\n", stream.large_hash.size);
2654 }
2655 }
2656
2657 if (option_verbose > 2)
2658 {
2659 XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n", stream.n_scpy, stream.l_scpy);
2660 XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n", stream.n_tcpy, stream.l_tcpy);
2661 XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add);
2662 XPR(NT "runs: %"Q"u (%"Q"u bytes)\n", stream.n_run, stream.l_run);
2663 }
2664
2640 xd3_free_stream (& stream); 2665 xd3_free_stream (& stream);
2641 2666
2642 if (option_verbose) 2667 if (option_verbose)
@@ -2870,7 +2895,10 @@ main (int argc, char **argv)
2870 /* only set profile count once, since... */ 2895 /* only set profile count once, since... */
2871 if (option_profile_cnt == 0) 2896 if (option_profile_cnt == 0)
2872 { 2897 {
2873 if ((ret = main_atou(my_optarg, (usize_t*) & option_profile_cnt, 0, 'P'))) { goto exit; } 2898 if ((ret = main_atou(my_optarg, (usize_t*) & option_profile_cnt, 0, 0, 'P')))
2899 {
2900 goto exit;
2901 }
2874 2902
2875 if (option_profile_cnt <= 0) 2903 if (option_profile_cnt <= 0)
2876 { 2904 {
@@ -2891,12 +2919,15 @@ main (int argc, char **argv)
2891 else { option_appheader = (uint8_t*) my_optarg; } break; 2919 else { option_appheader = (uint8_t*) my_optarg; } break;
2892 case 'B': 2920 case 'B':
2893 option_srcwinsz_set = 1; 2921 option_srcwinsz_set = 1;
2894 if ((ret = main_atou (my_optarg, & option_srcwinsz, XD3_ALLOCSIZE, 'B'))) 2922 if ((ret = main_atou (my_optarg, & option_srcwinsz, XD3_MINSRCWINSZ,
2923 0, 'B')))
2895 { 2924 {
2896 goto exit; 2925 goto exit;
2897 } 2926 }
2898 break; 2927 break;
2899 case 'W': if ((ret = main_atou (my_optarg, & option_winsize, XD3_ALLOCSIZE, 'W'))) 2928 case 'W':
2929 if ((ret = main_atou (my_optarg, & option_winsize, XD3_ALLOCSIZE,
2930 XD3_HARDMAXWINSIZE, 'W')))
2900 { 2931 {
2901 goto exit; 2932 goto exit;
2902 } 2933 }
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index fdebffe..520ec81 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -559,34 +559,27 @@ def ReportSpeed(L,tr,desc):
559 print '%s 0-run length %u: dsize %u: time %.3f ms: encode %.0f B/sec: in %ux%u trials' % \ 559 print '%s 0-run length %u: dsize %u: time %.3f ms: encode %.0f B/sec: in %ux%u trials' % \
560 (desc, L, tr.r1.dsize, tr.time.mean * 1000.0, ((L+tr.r1.dsize) / tr.time.mean), tr.trials, tr.reps) 560 (desc, L, tr.r1.dsize, tr.time.mean * 1000.0, ((L+tr.r1.dsize) / tr.time.mean), tr.trials, tr.reps)
561 561
562def BigFileRuns(rcsf): 562def MakeBigFiles(rcsf):
563 while 1: 563 rand = random.Random()
564 564 f1 = open(TMPDIR + "/big.1", "w")
565 rand = random.Random() 565 f2 = open(TMPDIR + "/big.2", "w")
566 f1 = open(TMPDIR + "/big.1", "w") 566 f1sz = 0
567 f2 = open(TMPDIR + "/big.2", "w") 567 f2sz = 0
568 f1sz = 0 568 for file in rcsf.rcsfiles:
569 f2sz = 0 569 if file.versions < 2:
570 for file in rcsf.rcsfiles: 570 continue
571 if file.versions < 2: 571 r1 = 0
572 continue 572 r2 = 0
573 r1 = 0 573 while r1 == r2:
574 r2 = 0 574 r1 = rand.randint(0, len(file.versions) - 1)
575 while r1 == r2: 575 r2 = rand.randint(0, len(file.versions) - 1)
576 r1 = rand.randint(0, len(file.versions) - 1) 576 f1sz += file.AppendVersion(f1, r1)
577 r2 = rand.randint(0, len(file.versions) - 1) 577 f2sz += file.AppendVersion(f2, r2)
578 f1sz += file.AppendVersion(f1, r1) 578
579 f2sz += file.AppendVersion(f2, r2) 579 f1.close()
580 580 f2.close()
581 f1.close() 581 return (TMPDIR + "/big.1",
582 f2.close() 582 TMPDIR + "/big.2")
583
584 print "Test input sizes: %d %d" % (f1sz, f2sz)
585
586 BigFileRun(TMPDIR + "/big.1",
587 TMPDIR + "/big.2")
588 #continue
589 #end
590 583
591def BigFileRun(f1, f2): 584def BigFileRun(f1, f2):
592 585
@@ -616,12 +609,12 @@ def BigFileRun(f1, f2):
616def RandomBigRun(f1, f2): 609def RandomBigRun(f1, f2):
617 610
618 input_ranges = [ 611 input_ranges = [
619 (7, 13, 'large_look'), 612 (7, 9, 'large_look'),
620 (1, 50, 'large_step'), 613 (1, 10, 'large_step'),
621 (4, 6, 'small_look'), 614 (4, 5, 'small_look'),
622 (1, 10, 'small_chain'), 615 (1, 20, 'small_chain'),
623 (1, 5, 'small_lchain'), 616 (1, 10, 'small_lchain'),
624 (0, 0, 'ssmatch'), 617 (0, 1, 'ssmatch'),
625 (0, 1, 'trylazy'), 618 (0, 1, 'trylazy'),
626 (1, 32, 'max_lazy'), 619 (1, 32, 'max_lazy'),
627 (1, 64, 'long_enough'), 620 (1, 64, 'long_enough'),
@@ -656,6 +649,8 @@ def RandomBigRun(f1, f2):
656 result.time.mean, 649 result.time.mean,
657 result.trials) 650 result.trials)
658 651
652 return (config, result.r1.dsize, result.time.mean)
653
659def RunSpeed(): 654def RunSpeed():
660 for L in Decimals(MAX_RUN): 655 for L in Decimals(MAX_RUN):
661 SetFileSize(RUNFILE, L) 656 SetFileSize(RUNFILE, L)
@@ -670,8 +665,6 @@ if __name__ == "__main__":
670 #rcsf = Test() 665 #rcsf = Test()
671 #rcsf.PairsByDate(Xdelta3Pair()) 666 #rcsf.PairsByDate(Xdelta3Pair())
672 #RunSpeed() 667 #RunSpeed()
673 #BigFileRuns(rcsf)
674 #BigFileRun("/tmp/big.1", "/tmp/big.2")
675 while 1: 668 while 1:
676 try: 669 try:
677 RandomBigRun("/tmp/big.1", "/tmp/big.2") 670 RandomBigRun("/tmp/big.1", "/tmp/big.2")
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index 1694a6d..dc67848 100755
--- a/xdelta3/xdelta3-test.h
+++ b/xdelta3/xdelta3-test.h
@@ -1908,7 +1908,7 @@ test_identical_behavior (xd3_stream *stream, int ignore)
1908 if (memcmp (rec, buf, IDB_TGTSZ) != 0) { stream->msg = "wrong data reconstruction"; goto fail; } 1908 if (memcmp (rec, buf, IDB_TGTSZ) != 0) { stream->msg = "wrong data reconstruction"; goto fail; }
1909 1909
1910 /* Check that there was one copy per window. */ 1910 /* Check that there was one copy per window. */
1911 IF_DEBUG (if (stream->n_cpy != IDB_WINCNT || 1911 IF_DEBUG (if (stream->n_scpy != IDB_WINCNT ||
1912 stream->n_add != 0 || 1912 stream->n_add != 0 ||
1913 stream->n_run != 0) { stream->msg = "wrong copy count"; goto fail; }); 1913 stream->n_run != 0) { stream->msg = "wrong copy count"; goto fail; });
1914 1914
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 9d6c3b6..14a3c08 100755
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -1970,46 +1970,6 @@ xd3_sizeof_uint64_t (uint64_t num)
1970#endif 1970#endif
1971 1971
1972/****************************************************************************************** 1972/******************************************************************************************
1973 Debug instruction statistics
1974 ******************************************************************************************/
1975
1976#if XD3_DEBUG
1977static void
1978xd3_count_inst (xd3_stream *stream, uint code)
1979{
1980 IF_DEBUG1 ({
1981 if (stream->i_freqs == NULL &&
1982 (stream->i_freqs = xd3_alloc0 (stream, sizeof (stream->i_freqs[0]), 256)) == NULL) { abort (); }
1983
1984 stream->i_freqs[code] += 1;
1985 });
1986 stream->n_ibytes += 1;
1987}
1988
1989static void
1990xd3_count_mode (xd3_stream *stream, uint mode)
1991{
1992 IF_DEBUG1 ({
1993 if (stream->i_modes == NULL &&
1994 (stream->i_modes = xd3_alloc0 (stream, sizeof (stream->i_modes[0]), TOTAL_MODES (stream))) == NULL) { abort (); }
1995 stream->i_modes[mode] += 1;
1996 });
1997}
1998
1999static void
2000xd3_count_size (xd3_stream *stream, usize_t size)
2001{
2002 IF_DEBUG1({
2003 if (stream->i_sizes == NULL &&
2004 (stream->i_sizes = xd3_alloc0 (stream, sizeof (stream->i_sizes[0]), 64)) == NULL) { abort (); }
2005
2006 if (size < 64) { stream->i_sizes[size] += 1; }
2007 });
2008 stream->n_sbytes += xd3_sizeof_size (size);
2009}
2010#endif
2011
2012/******************************************************************************************
2013 Address cache stuff 1973 Address cache stuff
2014 ******************************************************************************************/ 1974 ******************************************************************************************/
2015 1975
@@ -2114,8 +2074,6 @@ xd3_encode_address (xd3_stream *stream, usize_t addr, usize_t here, uint8_t* mod
2114 2074
2115 xd3_update_cache (acache, addr); 2075 xd3_update_cache (acache, addr);
2116 2076
2117 IF_DEBUG (xd3_count_mode (stream, bestm));
2118
2119 (*mode) += bestm; 2077 (*mode) += bestm;
2120 2078
2121 return 0; 2079 return 0;
@@ -2368,10 +2326,6 @@ xd3_free_stream (xd3_stream *stream)
2368 } 2326 }
2369#endif 2327#endif
2370 2328
2371 IF_DEBUG (xd3_free (stream, stream->i_freqs));
2372 IF_DEBUG (xd3_free (stream, stream->i_modes));
2373 IF_DEBUG (xd3_free (stream, stream->i_sizes));
2374
2375 XD3_ASSERT (stream->alloc_cnt == stream->free_cnt); 2329 XD3_ASSERT (stream->alloc_cnt == stream->free_cnt);
2376 2330
2377 memset (stream, 0, sizeof (xd3_stream)); 2331 memset (stream, 0, sizeof (xd3_stream));
@@ -2768,16 +2722,22 @@ xd3_iopt_finish_encoding (xd3_stream *stream, xd3_rinst *inst)
2768 XD3_ASSERT (inst->addr >= src->srcbase); 2722 XD3_ASSERT (inst->addr >= src->srcbase);
2769 XD3_ASSERT (inst->addr + inst->size <= src->srcbase + src->srclen); 2723 XD3_ASSERT (inst->addr + inst->size <= src->srcbase + src->srclen);
2770 addr = (inst->addr - src->srcbase); 2724 addr = (inst->addr - src->srcbase);
2725 stream->n_scpy += 1;
2726 stream->l_scpy += inst->size;
2771 } 2727 }
2772 else 2728 else
2773 { 2729 {
2774 /* with source window: target copy address is offset by taroff. */ 2730 /* with source window: target copy address is offset by taroff. */
2775 addr = stream->taroff + (usize_t) inst->addr; 2731 addr = stream->taroff + (usize_t) inst->addr;
2732 stream->n_tcpy += 1;
2733 stream->l_tcpy += inst->size;
2776 } 2734 }
2777 } 2735 }
2778 else 2736 else
2779 { 2737 {
2780 addr = (usize_t) inst->addr; 2738 addr = (usize_t) inst->addr;
2739 stream->n_tcpy += 1;
2740 stream->l_tcpy += inst->size;
2781 } 2741 }
2782 2742
2783 XD3_ASSERT (inst->size >= MIN_MATCH); 2743 XD3_ASSERT (inst->size >= MIN_MATCH);
@@ -2788,9 +2748,6 @@ xd3_iopt_finish_encoding (xd3_stream *stream, xd3_rinst *inst)
2788 return ret; 2748 return ret;
2789 } 2749 }
2790 2750
2791 IF_DEBUG (stream->n_cpy += 1);
2792 IF_DEBUG (stream->l_cpy += inst->size);
2793
2794 IF_DEBUG1 ({ 2751 IF_DEBUG1 ({
2795 static int cnt; 2752 static int cnt;
2796 P(RINT "[iopt copy:%d] pos %"Q"u-%"Q"u addr %"Q"u-%"Q"u size %u\n", 2753 P(RINT "[iopt copy:%d] pos %"Q"u-%"Q"u addr %"Q"u-%"Q"u size %u\n",
@@ -2807,9 +2764,8 @@ xd3_iopt_finish_encoding (xd3_stream *stream, xd3_rinst *inst)
2807 2764
2808 if ((ret = xd3_emit_byte (stream, & DATA_TAIL (stream), inst->xtra))) { return ret; } 2765 if ((ret = xd3_emit_byte (stream, & DATA_TAIL (stream), inst->xtra))) { return ret; }
2809 2766
2810 IF_DEBUG (stream->n_run += 1); 2767 stream->n_run += 1;
2811 IF_DEBUG (stream->l_run += inst->size); 2768 stream->l_run += inst->size;
2812 IF_DEBUG (stream->n_dbytes += 1);
2813 2769
2814 IF_DEBUG1 ({ 2770 IF_DEBUG1 ({
2815 static int cnt; 2771 static int cnt;
@@ -2822,9 +2778,8 @@ xd3_iopt_finish_encoding (xd3_stream *stream, xd3_rinst *inst)
2822 if ((ret = xd3_emit_bytes (stream, & DATA_TAIL (stream), 2778 if ((ret = xd3_emit_bytes (stream, & DATA_TAIL (stream),
2823 stream->next_in + inst->pos, inst->size))) { return ret; } 2779 stream->next_in + inst->pos, inst->size))) { return ret; }
2824 2780
2825 IF_DEBUG (stream->n_add += 1); 2781 stream->n_add += 1;
2826 IF_DEBUG (stream->l_add += inst->size); 2782 stream->l_add += inst->size;
2827 IF_DEBUG (stream->n_dbytes += inst->size);
2828 2783
2829 IF_DEBUG1 ({ 2784 IF_DEBUG1 ({
2830 static int cnt; 2785 static int cnt;
@@ -3196,12 +3151,8 @@ xd3_emit_single (xd3_stream *stream, xd3_rinst *single, uint code)
3196 if (has_size) 3151 if (has_size)
3197 { 3152 {
3198 if ((ret = xd3_emit_size (stream, & INST_TAIL (stream), single->size))) { return ret; } 3153 if ((ret = xd3_emit_size (stream, & INST_TAIL (stream), single->size))) { return ret; }
3199
3200 IF_DEBUG (xd3_count_size (stream, single->size));
3201 } 3154 }
3202 3155
3203 IF_DEBUG (xd3_count_inst (stream, code));
3204
3205 return 0; 3156 return 0;
3206} 3157}
3207 3158
@@ -3225,8 +3176,6 @@ xd3_emit_double (xd3_stream *stream, xd3_rinst *first, xd3_rinst *second, uint c
3225 second->size, 3176 second->size,
3226 code)); 3177 code));
3227 3178
3228 IF_DEBUG (xd3_count_inst (stream, code));
3229
3230 return 0; 3179 return 0;
3231} 3180}
3232 3181
@@ -3496,23 +3445,22 @@ xd3_encode_init (xd3_stream *stream)
3496 // TODO: experiments have to be done!!! 3445 // TODO: experiments have to be done!!!
3497 if (large_comp) 3446 if (large_comp)
3498 { 3447 {
3499 usize_t hash_values = (stream->srcwin_maxsz / stream->smatcher.large_look); 3448 usize_t hash_values = (stream->srcwin_maxsz / stream->smatcher.large_step);
3500 3449
3501 xd3_size_hashtable (stream, 3450 xd3_size_hashtable (stream,
3502 hash_values, 3451 hash_values,
3503 & stream->large_hash); 3452 & stream->large_hash);
3504 IF_DEBUG1 (P(RINT "[encode_init] large hash %u slots\n", hash_values));
3505 } 3453 }
3506 3454
3507 if (small_comp) 3455 if (small_comp)
3508 { 3456 {
3509 /* Hard-coded, keeps table small because small matches become inefficient. */ 3457 /* Hard-coded, keeps table small because small matches become inefficient. */
3510 usize_t hash_values = min(stream->winsize / stream->smatcher.small_look, 65536U); 3458 // TODO: verify this
3459 usize_t hash_values = min(stream->winsize, 65536U);
3511 3460
3512 xd3_size_hashtable (stream, 3461 xd3_size_hashtable (stream,
3513 hash_values, 3462 hash_values,
3514 & stream->small_hash); 3463 & stream->small_hash);
3515 IF_DEBUG1 (P(RINT "[encode_init] small hash %u slots\n", hash_values));
3516 } 3464 }
3517 3465
3518 for (i = 0; i < ENC_SECTS; i += 1) 3466 for (i = 0; i < ENC_SECTS; i += 1)
@@ -4040,6 +3988,7 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
4040 diff = logical_input_cksum_pos - stream->srcwin_cksum_pos; 3988 diff = logical_input_cksum_pos - stream->srcwin_cksum_pos;
4041 onblk = min(blkoff + diff, onblk); 3989 onblk = min(blkoff + diff, onblk);
4042 3990
3991 // TODO: is this inefficient for large_step < large_look?
4043 while (blkoff <= onblk) 3992 while (blkoff <= onblk)
4044 { 3993 {
4045 uint32_t cksum = xd3_lcksum (stream->src->curblk + blkoff, stream->smatcher.large_look); 3994 uint32_t cksum = xd3_lcksum (stream->src->curblk + blkoff, stream->smatcher.large_look);
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index 2ae1273..0c5bd43 100755
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -45,7 +45,7 @@
45 45
46/* Default total size of the source window used in xdelta3-main.h */ 46/* Default total size of the source window used in xdelta3-main.h */
47#ifndef XD3_DEFAULT_SRCWINSZ 47#ifndef XD3_DEFAULT_SRCWINSZ
48#define XD3_DEFAULT_SRCWINSZ (1U << 23) 48#define XD3_DEFAULT_SRCWINSZ (1U << 26)
49#endif 49#endif
50 50
51/* When Xdelta requests a memory allocation for certain buffers, it rounds up to units of 51/* When Xdelta requests a memory allocation for certain buffers, it rounds up to units of
@@ -61,7 +61,7 @@
61 * without a copy window will require 3 bytes to encode (7 bits per byte, HERE and SAME 61 * without a copy window will require 3 bytes to encode (7 bits per byte, HERE and SAME
62 * modes making every address within half the window away. */ 62 * modes making every address within half the window away. */
63#ifndef XD3_HARDMAXWINSIZE 63#ifndef XD3_HARDMAXWINSIZE
64#define XD3_HARDMAXWINSIZE (1U<<23) 64#define XD3_HARDMAXWINSIZE (1U<<24)
65#endif 65#endif
66 66
67/* The XD3_NODECOMPRESSSIZE parameter tells the xdelta main routine not to try to 67/* The XD3_NODECOMPRESSSIZE parameter tells the xdelta main routine not to try to
@@ -774,27 +774,21 @@ struct _xd3_stream
774 xd3_sec_stream *sec_stream_i; 774 xd3_sec_stream *sec_stream_i;
775 xd3_sec_stream *sec_stream_a; 775 xd3_sec_stream *sec_stream_a;
776 776
777#if XD3_DEBUG
778 /* statistics */ 777 /* statistics */
779 usize_t n_cpy; 778 xoff_t n_scpy;
780 usize_t n_add; 779 xoff_t n_tcpy;
781 usize_t n_run; 780 xoff_t n_add;
782 781 xoff_t n_run;
783 usize_t n_ibytes;
784 usize_t n_sbytes;
785 usize_t n_dbytes;
786 782
787 usize_t l_cpy; 783 xoff_t l_scpy;
788 usize_t l_add; 784 xoff_t l_tcpy;
789 usize_t l_run; 785 xoff_t l_add;
786 xoff_t l_run;
790 787
788#if XD3_DEBUG
791 usize_t sh_searches; 789 usize_t sh_searches;
792 usize_t sh_compares; 790 usize_t sh_compares;
793 791
794 usize_t *i_freqs;
795 usize_t *i_modes;
796 usize_t *i_sizes;
797
798 usize_t large_ckcnt; 792 usize_t large_ckcnt;
799 793
800 /* memory usage */ 794 /* memory usage */