Comment: | Greatly improve OFObject's memory handling and performance.
A linked-list is put before each memory chunk allocated instead of As allocating bigger chunks seems to be a little bit slower than smaller |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
28170f5f658db22d78a3a3c69421419c |
User & Date: | js on 2012-03-15 11:29:24 |
Other Links: | manifest | tags |
2012-03-16
| ||
14:01 | One malloc less when allocating a string. check-in: 3005748a9d user: js tags: trunk | |
2012-03-15
| ||
11:29 | Greatly improve OFObject's memory handling and performance. check-in: 28170f5f65 user: js tags: trunk | |
2012-03-14
| ||
15:47 | gcc is stupid... check-in: 8cf554bd32 user: js tags: trunk | |
Modified src/OFBlock.m from [aca779a840] to [5825d5d284].
︙ | |||
390 391 392 393 394 395 396 | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | - - - - - - | { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } - init { |
︙ |
Modified src/OFConstantString.m from [1513456645] to [e6c815e41d].
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - - - - - | @implementation OFString_const + alloc { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } |
︙ | |||
177 178 179 180 181 182 183 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | - - - - - - | + alloc { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } |
︙ |
Modified src/OFObject.h from [df231ae667] to [5a4773192e].
︙ | |||
472 473 474 475 476 477 478 | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | - - - - - - - - - - | * * This is mostly for debugging purposes. * * \return A description for the object */ - (OFString*)description; |
︙ |
Modified src/OFObject.m from [eb1f0d3652] to [329e3b32bd].
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - + + - + + + + + + + + + | #if defined(OF_ATOMIC_OPS) # import "atomic.h" #elif defined(OF_THREADS) # import "threading.h" #endif struct pre_ivar { |
︙ | |||
234 235 236 237 238 239 240 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - - | size_t instanceSize = class_getInstanceSize(self); if ((instance = calloc(instanceSize + PRE_IVAR_ALIGN, 1)) == NULL) { alloc_failed_exception.isa = [OFAllocFailedException class]; @throw (OFAllocFailedException*)&alloc_failed_exception; } |
︙ | |||
749 750 751 752 753 754 755 | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | - - - - - - - - - - - - - - - - - - - - - - - + - - + - - - - - + - - + + + - - + + - - - - - + + + - + - - - + - + + + - + + + - - - - - + + - - + + - - - + + + + + + + + + + - - + | - (OFString*)description { /* Classes containing data should reimplement this! */ return [OFString stringWithFormat: @"<%@: %p>", [self className], self]; } |
︙ | |||
870 871 872 873 874 875 876 | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | - - - - - - + + - - - - + + - - - - - + - - + - - + - - - + - - - - - - + + + + + - - - - - + - - + - - + - - - - + | return [self resizeMemory: pointer toSize: nItems * size]; } - (void)freeMemory: (void*)pointer { |
︙ | |||
987 988 989 990 991 992 993 | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + - - - + + + - - + + + + | return NO; } - (void)dealloc { Class class; void (*last)(id, SEL) = NULL; |
︙ | |||
1035 1036 1037 1038 1039 1040 1041 | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | - - - - - - | return [(id)self mutableCopy]; } /* * Those are needed as the root class is the superclass of the root class's * metaclass and thus instance methods can be sent to class objects as well. */ |
︙ |
Modified src/OFString_UTF8.m from [df8f106867] to [2df9fbd0df].
︙ | |||
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | + - - + + - - + + - - - + + + + + - | - initWithFormat: (OFConstantString*)format arguments: (va_list)arguments { self = [super init]; @try { char *tmp; int cStringLength; if (format == nil) @throw [OFInvalidArgumentException exceptionWithClass: isa selector: _cmd]; s = [self allocMemoryWithSize: sizeof(*s)]; memset(s, 0, sizeof(*s)); |
︙ |
Modified tests/OFObjectTests.m from [cd898a5b93] to [4509cfc31c].
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + - - - - - + + + + - + - + - - + + + | - (void)objectTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFObject *obj = [[[OFObject alloc] init] autorelease]; void *p, *q, *r; OFObject *o; MyObj *m; |
︙ |