On Fri, 18 Mar 2011 15:26:26 -0400 Matthew Mondor <mm_li...@pulsar-zone.net> wrote:
> Attached is the test CL code and the resulting C code with ECL. > So for the SVREF case indeed 0-1 safety levels allow better > optimization, and ecl_aref1() is used at higher levels. When I started looking at the array implementation, it was because I was trying to optimize a prototype application which initially used lists a lot. An early test replacing a list by an array in a particular scenario didn't seem impressive, but after more tests I can say that indeed a significant performance gain can be achieved with arrays. The following example function demonstrates that ECL can generate nice code even with AREF: (defun test () (declare (optimize (safety 0) (speed 3))) (let ((a (make-array 4096 :element-type 'ext::integer16 :fill-pointer nil :adjustable nil))) (loop for i of-type fixnum from 0 below 4096 do (setf (aref a i) i)) a)) static cl_object L1test() { VT2 VLEX2 CLSR2 STCK2 const cl_env_ptr cl_env_copy = ecl_process_env(); cl_object value0; TTL: { cl_object V1; /* A */ V1 = si_make_vector(ECL_SYM("INTEGER16", 1312), MAKE_FIXNUM(4096), Cnil, Cnil, Cnil, MAKE_FIXNUM(0)) /* MAKE-VECTOR */ ; { cl_fixnum V2; /* I */ V2 = 0; L5: ; (V1)->vector.self.i16[V2] = V2; V2 = (V2) + 1; if (!((V2) >= (4096))) { goto L12; } goto L6; L12: ; goto L10; L10: ; goto L5; L6: ; goto L2; } L2: ; value0 = V1; cl_env_copy->nvalues = 1; return value0; } } 00000770 <L1test>: 770: 55 push %ebp 771: b9 03 00 00 00 mov $0x3,%ecx 776: 89 e5 mov %esp,%ebp 778: ba 01 00 00 00 mov $0x1,%edx 77d: 56 push %esi 77e: be 01 00 00 00 mov $0x1,%esi 783: 53 push %ebx 784: e8 6c 00 00 00 call 7f5 <__i686.get_pc_thunk.bx> 789: 81 c3 33 12 00 00 add $0x1233,%ebx 78f: 83 ec 20 sub $0x20,%esp 792: 89 4c 24 14 mov %ecx,0x14(%esp) 796: b9 01 00 00 00 mov $0x1,%ecx 79b: 89 54 24 10 mov %edx,0x10(%esp) 79f: ba 03 40 00 00 mov $0x4003,%edx 7a4: 89 74 24 0c mov %esi,0xc(%esp) 7a8: 89 54 24 04 mov %edx,0x4(%esp) 7ac: 89 4c 24 08 mov %ecx,0x8(%esp) 7b0: 8b 83 f4 ff ff ff mov 0xfffffff4(%ebx),%eax 7b6: 05 80 8f 00 00 add $0x8f80,%eax 7bb: 89 04 24 mov %eax,(%esp) 7be: e8 cd fd ff ff call 590 <si_make_vector@plt> 7c3: 31 d2 xor %edx,%edx 7c5: 89 c6 mov %eax,%esi 7c7: 89 f6 mov %esi,%esi 7c9: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi 7d0: 8b 46 10 mov 0x10(%esi),%eax 7d3: 66 89 14 50 mov %dx,(%eax,%edx,2) 7d7: 42 inc %edx 7d8: 81 fa 00 10 00 00 cmp $0x1000,%edx 7de: 75 f0 jne 7d0 <L1test+0x60> 7e0: e8 db fd ff ff call 5c0 <ecl_process_env@plt> 7e5: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax) 7ec: 83 c4 20 add $0x20,%esp 7ef: 89 f0 mov %esi,%eax 7f1: 5b pop %ebx 7f2: 5e pop %esi 7f3: 5d pop %ebp 7f4: c3 ret Thanks for making this possible, -- Matt ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Ecls-list mailing list Ecls-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ecls-list